").text(s).html().replace("'", ''').replace('"', '"');
}
function wplc_uploaded_file_decorator(url){
var nmsg='';
url=wplc_sanitize_url(url);
if(url){
var ext=url.split(/\#|\?/)[0].split('.').pop().trim();
if(ext.match(/jpg|jpeg|gif|bmp|png/)){
nmsg='
';
}
if(nmsg==''){
nmsg=wp_url_decorator(url);
}}
return nmsg;
}
function wplcFormatParser(msg){
msg=wplc_safe_html(msg);
var tags=['img', 'link', 'video', 'vid'];
for (var i=0; i < tags.length; i++){
var url=msg.match(new RegExp('^' + tags[i] + ':(.*?):' + tags[i] + '$'));
if(url&&url[1]){
return wplc_uploaded_file_decorator(url[1]);
}}
if(msg.match(tcx_link_match_regex)){
return wp_url_decorator(msg);
}
if(msg.search(/\:(\S+)(\:)(\S+)\:/g)!==-1){
msg=msg.replace(/\:(\S+)(\:)(\S+)\:/g, function(match, p1, p2, p3){
return [":", p1, "::", p3, ":"].join('');
});
}
if(typeof wdtEmojiBundle!=="undefined"){
msg=wdtEmojiBundle.render(msg);
}
var italics_match=msg.match(/_([^*]*?)_/g);
if(italics_match!==null){
for (var i=0, len=italics_match.length; i < len; i++){
var to_find=italics_match[i];
var to_replace=to_find.substring(1, to_find.length - 1);
msg=msg.replace(to_find, "
" + to_replace + "");
}}
var bold_match=msg.match(/\*\s*([^*]*?)\s*\*/g);
if(bold_match!==null){
for (var i=0, len=bold_match.length; i < len; i++){
var to_find=bold_match[i];
var to_replace=to_find.substring(1, to_find.length - 1);
msg=msg.replace(to_find, "
" + to_replace + "");
}}
var pre_match=msg.match(/```([^*]*?)```/g);
if(pre_match!==null){
for (var i=0, len=pre_match.length; i < len; i++){
var to_find=pre_match[i];
var to_replace=to_find.substring(3, to_find.length - 3);
msg=msg.replace(to_find, "
" + to_replace + "
");
}}
var code_match=msg.match(/`([^*]*?)`/g);
if(code_match!==null){
for (var i=0, len=code_match.length; i < len; i++){
var to_find=code_match[i];
var to_replace=to_find.substring(1, to_find.length - 1);
msg=msg.replace(to_find, "
" + to_replace + "
");
}}
msg=msg.replace(/\n/g, "
");
return msg;
}
function wp_url_decorator(content){
return content.replace(tcx_link_match_regex, function(url){
url=encodeURI(url);
return '
' + wp_attachment_label_filter(url) + '';
});
}
function wp_attachment_label_filter(content){
var fileExt=content.split('.').pop();
var fileName=wplc_safe_html(content.split('/').pop());
fileExt=fileExt.toLowerCase();
for (var i in tcx_file_suffix_check){
if(fileExt===tcx_file_suffix_check[i]){
return '
' + fileName + '
';
}}
return content;
}
function wplc_sanitize_url(url){
return url.replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/, '');
}
function wplc_get_clean_gifurl(message_content){
var url=message_content.match(gifExtensionPattern);
if(url&&url[0]){
return wplc_sanitize_url(url[0]);
}
return "";
}
function wplc_auto_popup_do(mode){
switch (mode){
case 1:
setTimeout(function(){ if(!jQuery('#wp-live-chat-header').hasClass('active')){jQuery('#wp-live-chat-header').click();}}, 1000);
break;
case 2:
setTimeout(function(){ open_chat(0); }, 1000);
break;
}
wplc_is_chat_open=false;
};
var wplc_is_chat_open=false;
var wplc_online=false;
var wplc_agent_name="";
var msg_history=new Array();
var wplc_is_minimized=false;
var wplc_retry_interval=null;
var wplc_run=true;
var wplc_server=null;
wplc_server=new WPLCServer();
var wplc_server_last_loop_data=null;
var wplc_shown_welcome=false;
var wplc_current_agent=false;
var ns_obj={};
var welcome_message='';
var wplc_session_variable=new Date().getTime();
var wplc_cid;
var wplc_check_hide_cookie;
var wplc_chat_status="";
var wplc_cookie_name="";
var wplc_cookie_email="";
var wplc_init_chat_box_check=true;
var wplc_cid=null;
var initial_data={};
var wplc_fist_run=true;
var wplc_long_poll_delay=1500;
jQuery(function(){
jQuery('.wp-block-wp-live-chat-support-wplc-chat-box').on('click', function(){
jQuery("#wplc_hovercard").fadeOut("fast");
jQuery("#wplc-chat-alert").removeClass('is-active');
wplc_is_chat_open=true;
jQuery.event.trigger({ type: "wplc_open_chat" });
});
wplc_map_node_variables();
wplc_preload();
wplc_cid=Cookies.get('wplc_cid');
if(typeof wplc_cid==='undefined'){
wplc_cid=null;
}else{
wplc_cid=Cookies.get('wplc_cid');
}
wplc_check_hide_cookie=Cookies.get('wplc_hide');
wplc_check_minimize_cookie=Cookies.get('wplc_minimize');
wplc_chat_status=Cookies.get('wplc_chat_status');
wplc_cookie_name=Cookies.get('wplc_name');
wplc_cookie_email=Cookies.get('wplc_email');
Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
wplc_chat_status=5;
var wplc_wpml_body_language=jQuery("html").attr("lang");
if(typeof wplc_wpml_body_language!=="undefined"){
if(wplc_wpml_body_language.indexOf("-")!==-1){
wplc_wpml_body_language=wplc_wpml_body_language.substr(0, wplc_wpml_body_language.indexOf("-"));
}
Cookies.set('_icl_current_language', wplc_wpml_body_language, { expires: 1, path: '/' });
}
var data={
action: 'wplc_get_chat_box',
security: wplc_nonce,
cid: wplc_cid
};
jQuery.ajax({
url: wplc_ajaxurl_site,
data: data,
type: "POST",
success: function(response){
if(response){
if(response==="0"){
if(window.console){ console.log('WP Live Chat Support Return Error'); }
wplc_run=false;
return;
}
response=JSON.parse(response);
jQuery("body").append(response['cbox']);
wplc_listenForScrollEvent(jQuery("#wplc_chatbox"));
if(typeof wplc_cookie_name=='undefined'||typeof wplc_cookie_email=='undefined'){
try {
var wplc_cookie_name=jQuery(jQuery.parseHTML(response['cbox'])).find("#wplc_name").val().replace(/(<([^>]+)>)/ig, "");
} catch (e){}
try {
var wplc_cookie_email=jQuery(jQuery.parseHTML(response['cbox'])).find("#wplc_email").val().replace(/(<([^>]+)>)/ig, "");
} catch (e){}}
if(response['online']===false){
wplc_run=false;
wplc_online=false;
ns_obj.o='0';
}else{
wplc_online=true;
ns_obj.o='1';
}
if(!wplc_filter_run_override.value||wplc_online===false){ wplc_run=false; }else{ }
if(typeof response['type']==="undefined"){
wplc_shown_welcome=false;
}else{
if(response['type']==="returning"){
wplc_shown_welcome=true;
if(typeof response['agent_data']!=="undefined"){
wplc_current_agent=response['agent_data'];
}}else{
wplc_shown_welcome=false;
}}
var wplc_mobile_check=false;
if(typeof wplc_is_mobile!=="undefined"&&(wplc_is_mobile==="true"||wplc_is_mobile===true)){
wplc_mobile_check=true;
}
var data={
action: 'wplc_call_to_server_visitor',
security: wplc_nonce,
cid: wplc_cid,
wplc_name: wplc_cookie_name,
wplc_email: wplc_cookie_email,
status: wplc_chat_status,
wplcsession: wplc_session_variable,
wplc_is_mobile: wplc_mobile_check,
wplc_extra_data: wplc_extra_data
};
if(wplc_server.browserIsSocketReady()){
data.socket=true;
jQuery.event.trigger({ type: 'wplc_sockets_ready' });
}
initial_data=data;
if(!wplc_filter_run_override.value||wplc_online===false){
wplc_call_to_server_chat(data, true, true);
}else{
wplc_call_to_server_chat(data, true, false);
}
if(wplc_cid!==null&&wplc_init_chat_box_check==true&&wplc_init_chat_box!==false){
wplc_init_chat_box(wplc_cid, wplc_chat_status);
}else{
if(config.wplc_use_node_server){
if(wplc_check_hide_cookie!="yes"){
wplc_dc=setTimeout(function(){
wplc_cbox_animation();
}, parseInt(window.wplc_misc_strings.wplc_delay));
}}
}}
}});
function wplc_preload(){
var images=[];
if(typeof wplc_preload_images!=="undefined"&&typeof wplc_preload_images==="object"){
var wplc_i=0;
for (var key in wplc_preload_images){
if(wplc_preload_images.hasOwnProperty(key)){
images[wplc_i]=new Image();
images[wplc_i].src=wplc_preload_images[key];
wplc_i++;
}}
}}
function wplc_listenForScrollEvent(el){
el.on("scroll", function(){
el.trigger("wplc-custom-scroll");
})
}
jQuery("body").on('keyup', '#wplc_email, #wplc_name', function(e){
if(e.keyCode==13){
jQuery("#wplc_start_chat_btn").trigger("click")
}});
jQuery("body").on("click", "#wplc_end_chat_button", function(e){
var data={
security: wplc_nonce,
chat_id: wplc_cid,
agent_id: 0
};
jQuery(this).hide();
Cookies.remove('wplc_chat_status');
Cookies.remove('wplc_cid');
Cookies.remove('nc_status');
if(jQuery(this).attr('wplc_disable')===undefined&&jQuery(this).attr('wplc_disable')!=='true'){
wplc_rest_api('end_chat', data, 12000, null);
jQuery.event.trigger({ type: "wplc_end_chat_as_user" });
}});
jQuery(document).on("wplc_update_gdpr_last_chat_id", function(e){
jQuery('#wplc_gdpr_remove_data_button,#wplc_gdpr_download_data_button').attr('data-wplc-last-cid', wplc_cid);
});
setTimeout(function(){
if(jQuery('html').hasClass('nivo-lightbox-notouch')||jQuery('a[rel*="lightbox"]').length){
jQuery("body").on("keyup", function(event){
if(event.keyCode===13){
jQuery("#wplc_send_msg").trigger("click");
}});
}}, 5000);
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
setTimeout(function(){
var liveChat4=jQuery('#wp-live-chat-4');
var liveChat=jQuery('#wp-live-chat');
if(!liveChat.hasClass('classic')){
jQuery('body').on('click', function(event){
if(liveChat.hasClass('mobile-active')){
if(event.target.id!=='wplc_chatmsg'&&event.target.className!=='wdt-emoji-picker'){
liveChat4.removeClass('is-full-height');
}else{
liveChat4.addClass('is-full-height');
}}
});
}else{
jQuery('body').on('click', function(event){
if(liveChat.hasClass('mobile-active')){
if(event.target.id!=='wplc_chatmsg'&&event.target.className!=='wdt-emoji-picker'){
liveChat.removeClass('is-full-height');
}else{
liveChat.addClass('is-full-height');
}}
});
}}, 500);
}});
function wplc_map_node_variables(){
if(typeof wplc_welcome_msg!=="undefined"){
welcome_message=wplc_welcome_msg;
}}
function wplc_send_welcome_message(){
if(wplc_welcome_msg!==""&&!wplc_shown_welcome){
message_class="wplc-system-notification wplc-color-4 tmp-welcome-msg";
var concatenated_message="
";
concatenated_message +=wplc_safe_html(wplc_welcome_msg);
concatenated_message +="";
jQuery("#wplc_chatbox").append(concatenated_message);
wplc_scroll_to_bottom();
wplc_shown_welcome=true;
}}
jQuery(function(){
if(wplc_online){
jQuery(document).on('click', '#wp-live-chat-header', function(){
jQuery('#speeching_button').html(wplc_pro_sst1);
jQuery('#wplc_name').val(wplc_user_default_visitor_name);
})
}else{
jQuery('#wplc_na_msg_btn').val(wplc_pro_offline_btn_send);
}})
function wplc_scroll_to_bottom(){
var height=jQuery('#wplc_chatbox')[0].scrollHeight;
jQuery('#wplc_chatbox').scrollTop(height);
}
function wplc_user_message_receiver(data){
if(typeof wplc_loop_response_handler!=="undefined"&&typeof wplc_loop_response_handler==="function"){
wplc_loop_response_handler(data, wplc_server_last_loop_data);
data=JSON.parse(data);
if(typeof data['status']!=="undefined"){
delete wplc_server_last_loop_data.status;
}
if(data.keep_alive===true){
setTimeout(function(){
wplc_server_last_loop_data.status=wplc_chat_status;
wplc_call_to_server_chat(wplc_server_last_loop_data);
}, 100);
}}
}
function wplc_user_retry_handler(data){
var tstatus=Cookies.get("wplc_chat_status");
if(tstatus!=="undefined"){
if(tstatus!==8||tstatus!==1){
wplc_retry_interval=setTimeout(function(){
wplc_server.prepareTransport(function(){
wplc_server_last_loop_data.status=parseInt(tstatus);
wplc_call_to_server_chat(wplc_server_last_loop_data);
}, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error);
}, 500);
}}
}
function wplc_call_to_server_chat(data, first_run, short_poll){
if(config.wplc_use_node_server){
return;
}else{
if(typeof first_run==="undefined"){ first_run=false; };
if(typeof short_poll==="undefined"){ short_poll=false; };
data.first_run=first_run;
data.short_poll=short_poll;
if(typeof Cookies.get('wplc_name')!=="undefined"){
data.msg_from_print=Cookies.get('wplc_name');
}
wplc_server_last_loop_data=data;
wplc_server.send(wplc_ajaxurl, data, "POST", 120000,
function(response){
wplc_long_poll_delay=1500;
wplc_loop_response_handler(response, data);
},
function(jqXHR, exception){
wplc_long_poll_delay=5000;
if(jqXHR.status==404){
wplc_log_connection_error('Error: Requested page not found. [404]');
wplc_run=false;
}else if(jqXHR.status==500){
wplc_log_connection_error('Error: Internal Server Error [500].');
wplc_log_connection_error('Retrying in 5 seconds...');
wplc_run=true;
}else if(exception==='parsererror'){
wplc_log_connection_error('Error: Requested JSON parse failed.');
wplc_run=false;
}else if(exception==='abort'){
wplc_log_connection_error('Error: Ajax request aborted.');
wplc_run=false;
}else{
wplc_log_connection_error('Error: Uncaught Error.\n' + jqXHR.responseText);
wplc_log_connection_error('Retrying in 5 seconds...');
wplc_run=true;
}},
function(response){
if(wplc_run){
if(wplc_server.isInSocketMode()===false&&wplc_server.isPreparingSocketMode()===false){
setTimeout(function(){ wplc_call_to_server_chat(data, false, false); }, wplc_long_poll_delay);
}else if((wplc_server.isInSocketMode()===false&&wplc_server.isPreparingSocketMode()===true)&&(typeof wplc_transport_prepared!=="undefined"&&wplc_transport_prepared===false)){
if(config.wplc_use_node_server){
setTimeout(function(){
wplc_call_to_server_chat(data, false, true);
}, 7500);
}}else{
if(typeof response!=="undefined"&&typeof response.responseText!=="undefined"&&response.responseText!==""){
var response_data=JSON.parse(response.responseText);
if(typeof wplc_transport_prepared!=="undefined"){
if(wplc_transport_prepared!==true&&(parseInt(response_data.status)===3||parseInt(response_data.status)===2)){
wplc_server.prepareTransport(function(){ wplc_call_to_server_chat(data, false, false); }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error);
}}
}}
}});
}};
function wplc_loop_response_handler(response, data){
if(!response){
return;
}
if(response==="0"){
if(window.console){ console.log('WP Live Chat Support Return Error'); }
wplc_run=false;
return;
}
if(typeof response!=="object"){
response=JSON.parse(response);
}
data['action_2']="";
if(typeof response['wplc_name']!=="undefined"){ data['wplc_name']=response['wplc_name']; }
if(typeof response['wplc_email']!=="undefined"){ data['wplc_email']=response['wplc_email']; }
if(typeof response['cid']!=="undefined"){
data['cid']=response['cid'];
Cookies.set('wplc_cid', response['cid'], { expires: 1, path: '/' });
}
if(typeof response['aname']!=="undefined"){ wplc_agent_name=response['aname']; }
if(typeof response['cid']!=="undefined"&&wplc_cid!==jQuery.trim(response['cid'])){
wplc_cid=jQuery.trim(response['cid']);
jQuery("#wplc_cid").val(wplc_cid);
}
if(typeof response['status']!=="undefined"&&parseInt(wplc_chat_status)!==parseInt(response['status'])){
wplc_chat_status=response['status'];
Cookies.set('wplc_chat_status', null, { path: '/' });
Cookies.set('wplc_chat_status', wplc_chat_status, { expires: 1, path: '/' });
}
jQuery.event.trigger({ type: "wplc_user_chat_loop", response: response });
if(data['status']==response['status']){
if(data['status']==5&&wplc_init_chat_box_check===true&&wplc_init_chat_box!==false){
wplc_init_chat_box(data['cid'], data['status']);
}
if((response['status']==3||response['status']==2)&&response['data']!=null){
wplc_run=true;
var wplc_new_message_sound=false;
if(typeof response['data']==="object"){
for (var index in response['data']){
if(typeof response['data'][index]!=="object"){
if(typeof msg_history[index]==="undefined"){
msg_history[index]=true;
jQuery("#wplc_chatbox").append(wplcFormatParser(response['data'][index]));
wplc_new_message_sound=true;
}else{
}}else{
var the_message=response['data'][index];
the_message.mid=index;
wplc_push_message_to_chatbox(the_message, 'u', function(){ wplc_scroll_to_bottom(); });
wplc_new_message_sound=true;
}}
}else{
jQuery("#wplc_chatbox").append(wplcFormatParser(response['data']));
wplc_new_message_sound=true;
}
if(wplc_new_message_sound){
wplc_scroll_to_bottom();
if(!!wplc_enable_ding.value){
new Audio(wplc_plugin_url + 'includes/sounds/general/ding.mp3').play();
}}
}}else{
data['status']=wplc_chat_status;
Cookies.set('wplc_chat_status', wplc_chat_status, { expires: 1, path: '/' });
if(response['status']==0||response['status']==12){
jQuery("#wp-live-chat-3").hide();
if(typeof response['data']!=="undefined"){
if(!!response['preformatted']){
jQuery("#wplc_chatbox").append(response['data'] + '
');
}else{
jQuery("#wplc_chatbox").append(wplc_safe_html(response['data']) + '
');
}}
}else if(response['status']==8){
wplc_run=false;
document.getElementById('wplc_chatmsg').disabled=true;
wplc_shown_welcome=false;
the_message=wplc_generate_system_notification_object(wplc_error_messages.chat_ended_by_operator, {}, 0);
wplc_push_message_to_chatbox(the_message, 'u', function(){ wplc_scroll_to_bottom(); });
jQuery.event.trigger({ type: "wplc_end_chat" });
}else if(parseInt(response['status'])==11){
jQuery("#wp-live-chat").css({ "display": "none" });
wplc_run=false;
}else if(parseInt(response['status'])==3||parseInt(response['status'])==2||parseInt(response['status'])==10){
wplc_run=true;
if(parseInt(response['status'])==3){
if(config.wplc_use_node_server){
if(typeof wplc_transport_prepared!=="undefined"&&wplc_transport_prepared===false){
wplc_server.prepareTransport(function(){ wplc_call_to_server_chat(wplc_server_last_loop_data, false, false); }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error);
}}
if(!wplc_is_minimized){
if(!wplc_is_chat_open){
wplc_cbox_animation();
setTimeout(function(){ open_chat(0); }, 1500);
}}
if(jQuery('#wp-live-chat').hasClass('wplc_left')===true||jQuery('#wp-live-chat').hasClass('wplc_right')===true){
}}
if(parseInt(response['status'])==10){
wplc_run=true;
open_chat(0);
}
if(response['data']!=null){
if(typeof response['data']==="object"){
for (var index in response['data']){
wplc_new_message_sound=false;
if(typeof response['data'][index]!=="object"){
if(typeof msg_history[index]==="undefined"){
msg_history[index]=true;
jQuery("#wplc_chatbox").append(wplcFormatParser(response['data'][index]));
wplc_new_message_sound=true;
}else{
}}else{
var the_message=response['data'][index];
the_message.mid=index;
wplc_push_message_to_chatbox(the_message, 'u', function(){ wplc_scroll_to_bottom(); });
}
if(wplc_new_message_sound){
if(response['alert']){
jQuery('#wplc-chat-alert').addClass('is-active');
}
wplc_scroll_to_bottom();
if(!!wplc_enable_ding.value){
new Audio(wplc_plugin_url + 'includes/sounds/general/ding.mp3').play();
}}
}}else{
jQuery("#wplc_chatbox").append(wplcFormatParser(response['data']));
}
wplc_scroll_to_bottom();
}}
}}
function wplc_log_connection_error(error){
if(window.console){ console.log(error); }
jQuery("#wplc_chatbox").append("
" + error + "");
wplc_scroll_to_bottom();
}
function wplc_display_error(error){
the_message={};
the_message.originates=2;
the_message.msg=error;
the_message.other={};
var wplc_d=new Date();
the_message.other.datetime=Math.round(wplc_d.getTime() / 1000);
wplc_push_message_to_chatbox(the_message, 'u', function(){
wplc_scroll_to_bottom();
});
}
var wplc_init_chat_box=function(cid, status){
if(wplc_chat_status==9&&wplc_check_hide_cookie=="yes"){}else if(wplc_chat_status===3){
wplc_cbox_animation();
}else{
if(wplc_check_hide_cookie!="yes"){
wplc_dc=setTimeout(function(){
wplc_cbox_animation();
}, parseInt(window.wplc_misc_strings.wplc_delay));
}}
wplc_init_chat_box=false;
jQuery.event.trigger({ type: "wplc_init_complete" });
}
function wplc_cbox_animation(){
var wplc_window_id=jQuery("#wp-live-chat");
var wplc_theme_chosen=jQuery(wplc_window_id).attr('wplc_animation');
switch (wplc_theme_chosen){
case 'none':
jQuery(wplc_window_id).css('display', 'block');
break;
case 'animation-1':
jQuery(wplc_window_id).animate({ 'marginBottom': '0px' }, 1000);
break;
case 'animation-2-bl':
jQuery(wplc_window_id).animate({ 'left': '20px' }, 1000);
break;
case 'animation-2-br':
jQuery(wplc_window_id).animate({ 'right': '20px' }, 1000);
break;
case 'animation-2-l':
jQuery(wplc_window_id).animate({ "left": '0px' }, 1000);
break;
case 'animation-2-r':
jQuery(wplc_window_id).animate({ 'right': '0px' }, 1000);
break;
case 'animation-3':
jQuery(wplc_window_id).fadeIn('slow');
case 'animation-4':
jQuery(wplc_window_id).css('display', 'block');
break;
default:
jQuery(wplc_window_id).css('display', 'block');
break;
}
var wplc_auto_popup=parseInt(jQuery("#wp-live-chat").attr('wplc-auto-pop-up'));
if(wplc_auto_popup > 0){
var wplc_force_must_min=Cookies.get('wplc_minimize');
if(wplc_force_must_min==='yes'){
}else{
wplc_auto_popup_do(wplc_auto_popup);
}}
jQuery.event.trigger({ type: "wplc_animation_done" });
}
function wplc_sound(source, volume, loop){
this.source=source;
this.volume=volume;
this.loop=loop;
var son;
this.son=son;
this.finish=false;
this.stop=function(){
document.body.removeChild(this.son);
}
this.start=function(){
if(this.finish) return false;
this.son=document.createElement("embed");
this.son.setAttribute("src", this.source);
this.son.setAttribute("hidden", "true");
this.son.setAttribute("volume", this.volume);
this.son.setAttribute("autostart", "true");
this.son.setAttribute("loop", this.loop);
document.body.appendChild(this.son);
}
this.remove=function(){
document.body.removeChild(this.son);
this.finish=true;
}
this.init=function(volume, loop){
this.finish=false;
this.volume=volume;
this.loop=loop;
}}
(function($){
$(function(event){
if(!window.wdtEmojiBundle)
return;
$(document.body).on("click", function(event){
if($(event.target).closest(".wdt-emoji-picker, .wdt-emoji-popup").length==0&&!(
event.target.parentNode==null&&$(event.target).hasClass("fa-smile")
))
wdtEmojiBundle.close();
});
$(window).scroll(function(event){
wdtEmojiBundle.close();
});
});
})(jQuery);
function md5cycle(x, k){
var a=x[0], b=x[1], c=x[2], d=x[3];
a=wplc_ff(a, b, c, d, k[0], 7, -680876936);
d=wplc_ff(d, a, b, c, k[1], 12, -389564586);
c=wplc_ff(c, d, a, b, k[2], 17, 606105819);
b=wplc_ff(b, c, d, a, k[3], 22, -1044525330);
a=wplc_ff(a, b, c, d, k[4], 7, -176418897);
d=wplc_ff(d, a, b, c, k[5], 12, 1200080426);
c=wplc_ff(c, d, a, b, k[6], 17, -1473231341);
b=wplc_ff(b, c, d, a, k[7], 22, -45705983);
a=wplc_ff(a, b, c, d, k[8], 7, 1770035416);
d=wplc_ff(d, a, b, c, k[9], 12, -1958414417);
c=wplc_ff(c, d, a, b, k[10], 17, -42063);
b=wplc_ff(b, c, d, a, k[11], 22, -1990404162);
a=wplc_ff(a, b, c, d, k[12], 7, 1804603682);
d=wplc_ff(d, a, b, c, k[13], 12, -40341101);
c=wplc_ff(c, d, a, b, k[14], 17, -1502002290);
b=wplc_ff(b, c, d, a, k[15], 22, 1236535329);
a=wplc_gg(a, b, c, d, k[1], 5, -165796510);
d=wplc_gg(d, a, b, c, k[6], 9, -1069501632);
c=wplc_gg(c, d, a, b, k[11], 14, 643717713);
b=wplc_gg(b, c, d, a, k[0], 20, -373897302);
a=wplc_gg(a, b, c, d, k[5], 5, -701558691);
d=wplc_gg(d, a, b, c, k[10], 9, 38016083);
c=wplc_gg(c, d, a, b, k[15], 14, -660478335);
b=wplc_gg(b, c, d, a, k[4], 20, -405537848);
a=wplc_gg(a, b, c, d, k[9], 5, 568446438);
d=wplc_gg(d, a, b, c, k[14], 9, -1019803690);
c=wplc_gg(c, d, a, b, k[3], 14, -187363961);
b=wplc_gg(b, c, d, a, k[8], 20, 1163531501);
a=wplc_gg(a, b, c, d, k[13], 5, -1444681467);
d=wplc_gg(d, a, b, c, k[2], 9, -51403784);
c=wplc_gg(c, d, a, b, k[7], 14, 1735328473);
b=wplc_gg(b, c, d, a, k[12], 20, -1926607734);
a=wplc_hh(a, b, c, d, k[5], 4, -378558);
d=wplc_hh(d, a, b, c, k[8], 11, -2022574463);
c=wplc_hh(c, d, a, b, k[11], 16, 1839030562);
b=wplc_hh(b, c, d, a, k[14], 23, -35309556);
a=wplc_hh(a, b, c, d, k[1], 4, -1530992060);
d=wplc_hh(d, a, b, c, k[4], 11, 1272893353);
c=wplc_hh(c, d, a, b, k[7], 16, -155497632);
b=wplc_hh(b, c, d, a, k[10], 23, -1094730640);
a=wplc_hh(a, b, c, d, k[13], 4, 681279174);
d=wplc_hh(d, a, b, c, k[0], 11, -358537222);
c=wplc_hh(c, d, a, b, k[3], 16, -722521979);
b=wplc_hh(b, c, d, a, k[6], 23, 76029189);
a=wplc_hh(a, b, c, d, k[9], 4, -640364487);
d=wplc_hh(d, a, b, c, k[12], 11, -421815835);
c=wplc_hh(c, d, a, b, k[15], 16, 530742520);
b=wplc_hh(b, c, d, a, k[2], 23, -995338651);
a=wplc_ii(a, b, c, d, k[0], 6, -198630844);
d=wplc_ii(d, a, b, c, k[7], 10, 1126891415);
c=wplc_ii(c, d, a, b, k[14], 15, -1416354905);
b=wplc_ii(b, c, d, a, k[5], 21, -57434055);
a=wplc_ii(a, b, c, d, k[12], 6, 1700485571);
d=wplc_ii(d, a, b, c, k[3], 10, -1894986606);
c=wplc_ii(c, d, a, b, k[10], 15, -1051523);
b=wplc_ii(b, c, d, a, k[1], 21, -2054922799);
a=wplc_ii(a, b, c, d, k[8], 6, 1873313359);
d=wplc_ii(d, a, b, c, k[15], 10, -30611744);
c=wplc_ii(c, d, a, b, k[6], 15, -1560198380);
b=wplc_ii(b, c, d, a, k[13], 21, 1309151649);
a=wplc_ii(a, b, c, d, k[4], 6, -145523070);
d=wplc_ii(d, a, b, c, k[11], 10, -1120210379);
c=wplc_ii(c, d, a, b, k[2], 15, 718787259);
b=wplc_ii(b, c, d, a, k[9], 21, -343485551);
x[0]=add32(a, x[0]);
x[1]=add32(b, x[1]);
x[2]=add32(c, x[2]);
x[3]=add32(d, x[3]);
}
function wplc_cmn(q, a, b, x, s, t){
a=add32(add32(a, q), add32(x, t));
return add32((a << s) | (a >>> (32 - s)), b);
}
function wplc_ff(a, b, c, d, x, s, t){
return wplc_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function wplc_gg(a, b, c, d, x, s, t){
return wplc_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function wplc_hh(a, b, c, d, x, s, t){
return wplc_cmn(b ^ c ^ d, a, b, x, s, t);
}
function wplc_ii(a, b, c, d, x, s, t){
return wplc_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
function wplc_md51(s){
txt='';
var n=s.length,
state=[1732584193, -271733879, -1732584194, 271733878], i;
for (i=64; i<=s.length; i+=64){
md5cycle(state, md5blk(s.substring(i-64, i)));
}
s=s.substring(i-64);
var tail=[0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
for (i=0; i
>2] |=s.charCodeAt(i) << ((i%4) << 3);
tail[i>>2] |=0x80 << ((i%4) << 3);
if(i > 55){
md5cycle(state, tail);
for (i=0; i<16; i++) tail[i]=0;
}
tail[14]=n*8;
md5cycle(state, tail);
return state;
}
function md5blk(s){
var md5blks=[], i;
for (i=0; i<64; i+=4){
md5blks[i>>2]=s.charCodeAt(i)
+ (s.charCodeAt(i+1) << 8)
+ (s.charCodeAt(i+2) << 16)
+ (s.charCodeAt(i+3) << 24);
}
return md5blks;
}
var hex_chr='0123456789abcdef'.split('');
function wplc_rhex(n){
var s='', j=0;
for(; j<4; j++)
s +=hex_chr[(n >> (j * 8 + 4)) & 0x0F]
+ hex_chr[(n >> (j * 8)) & 0x0F];
return s;
}
function wplc_hex(x){
for (var i=0; i> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}};
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t,e){"object"===("undefined"==typeof t?"undefined":o(t))&&(e=t,t=void 0),e=e||{};var r,n=i(t),s=n.source,h=n.id,p=n.path,u=c[h]&&p in c[h].nsps,f=e.forceNew||e["force new connection"]||!1===e.multiplex||u;return f?r=a(s,e):(c[h]||(c[h]=a(s,e)),r=c[h]),n.query&&!e.query&&(e.query=n.query),r.socket(n.path,e)}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1),s=r(4),a=r(10);r(3)("socket.io-client");t.exports=e=n;var c=e.managers={};e.protocol=s.protocol,e.connect=n,e.Manager=r(10),e.Socket=r(34)},function(t,e,r){(function(e){"use strict";function n(t,r){var n=t;r=r||e.location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(t="undefined"!=typeof r?r.protocol+"//"+t:"https://"+t),n=o(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var i=n.host.indexOf(":")!==-1,s=i?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(r&&r.port===n.port?"":":"+n.port),n}var o=r(2);r(3)("socket.io-client:url");t.exports=n}).call(e,function(){return this}())},function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");o!=-1&&i!=-1&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=r.exec(t||""),a={},c=14;c--;)a[n[c]]=s[c]||"";return o!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e){"use strict";t.exports=function(){return function(){}}},function(t,e,r){function n(){}function o(t){var r=""+t.type;return e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(r+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(r+=t.nsp+","),null!=t.id&&(r+=t.id),null!=t.data&&(r+=JSON.stringify(t.data)),r}function i(t,e){function r(t){var r=l.deconstructPacket(t),n=o(r.packet),i=r.buffers;i.unshift(n),e(i)}l.removeBlobs(t,r)}function s(){this.reconstructor=null}function a(t){var r=0,n={type:Number(t.charAt(0))};if(null==e.types[n.type])return p();if(e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type){for(var o="";"-"!==t.charAt(++r)&&(o+=t.charAt(r),r!=t.length););if(o!=Number(o)||"-"!==t.charAt(r))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===t.charAt(r+1))for(n.nsp="";++r;){var i=t.charAt(r);if(","===i)break;if(n.nsp+=i,r===t.length)break}else n.nsp="/";var s=t.charAt(r+1);if(""!==s&&Number(s)==s){for(n.id="";++r;){var i=t.charAt(r);if(null==i||Number(i)!=i){--r;break}if(n.id+=t.charAt(r),r===t.length)break}n.id=Number(n.id)}return t.charAt(++r)&&(n=c(n,t.substr(r))),n}function c(t,e){try{t.data=JSON.parse(e)}catch(t){return p()}return t}function h(t){this.reconPack=t,this.buffers=[]}function p(){return{type:e.ERROR,data:"parser error"}}var u=(r(3)("socket.io-parser"),r(5)),f=r(6),l=r(8),d=r(9);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=n,e.Decoder=s,n.prototype.encode=function(t,r){if(t.type!==e.EVENT&&t.type!==e.ACK||!f(t.data)||(t.type=t.type===e.EVENT?e.BINARY_EVENT:e.BINARY_ACK),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)i(t,r);else{var n=o(t);r([n])}},u(s.prototype),s.prototype.add=function(t){var r;if("string"==typeof t)r=a(t),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new h(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!d(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,this.emit("decoded",r))}},s.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},h.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=l.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},h.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,r){function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},n.prototype.cleanup=function(){for(var t=this.subs.length,e=0;e=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):t.onreconnect()}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},n.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,r){t.exports=r(12),t.exports.parser=r(19)},function(t,e,r){(function(e){function n(t,r){if(!(this instanceof n))return new n(t,r);r=r||{},t&&"object"==typeof t&&(r=t,t=null),t?(t=h(t),r.hostname=t.host,r.secure="https"===t.protocol||"wss"===t.protocol,r.port=t.port,t.query&&(r.query=t.query)):r.host&&(r.hostname=h(r.host).host),this.secure=null!=r.secure?r.secure:e.location&&"https:"===location.protocol,r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.agent=r.agent||!1,this.hostname=r.hostname||(e.location?location.hostname:"localhost"),this.port=r.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=r.query||{},"string"==typeof this.query&&(this.query=p.decode(this.query)),this.upgrade=!1!==r.upgrade,this.path=(r.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!r.forceJSONP,this.jsonp=!1!==r.jsonp,this.forceBase64=!!r.forceBase64,this.enablesXDR=!!r.enablesXDR,this.timestampParam=r.timestampParam||"t",this.timestampRequests=r.timestampRequests,this.transports=r.transports||["polling","websocket"],this.transportOptions=r.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=r.policyPort||843,this.rememberUpgrade=r.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=r.onlyBinaryUpgrades,this.perMessageDeflate=!1!==r.perMessageDeflate&&(r.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=r.pfx||null,this.key=r.key||null,this.passphrase=r.passphrase||null,this.cert=r.cert||null,this.ca=r.ca||null,this.ciphers=r.ciphers||null,this.rejectUnauthorized=void 0===r.rejectUnauthorized||r.rejectUnauthorized,this.forceNode=!!r.forceNode;var o="object"==typeof e&&e;o.global===o&&(r.extraHeaders&&Object.keys(r.extraHeaders).length>0&&(this.extraHeaders=r.extraHeaders),r.localAddress&&(this.localAddress=r.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function o(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var i=r(13),s=r(5),a=(r(3)("engine.io-client:socket"),r(33)),c=r(19),h=r(2),p=r(27);t.exports=n,n.priorWebsocketSuccess=!1,s(n.prototype),n.protocol=c.protocol,n.Socket=n,n.Transport=r(18),n.transports=r(13),n.parser=r(19),n.prototype.createTransport=function(t){var e=o(this.query);e.EIO=c.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new i[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0});return n},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},n.prototype.probe=function(t){function e(){if(u.onlyBinaryUpgrades){var t=!this.supportsBinary&&u.transport.supportsBinary;p=p||t}p||(h.send([{type:"ping",data:"probe"}]),h.once("packet",function(t){if(!p)if("pong"===t.type&&"probe"===t.data){if(u.upgrading=!0,u.emit("upgrading",h),!h)return;n.priorWebsocketSuccess="websocket"===h.name,u.transport.pause(function(){p||"closed"!==u.readyState&&(c(),u.setTransport(h),h.send([{type:"upgrade"}]),u.emit("upgrade",h),h=null,u.upgrading=!1,u.flush())})}else{var e=new Error("probe error");e.transport=h.name,u.emit("upgradeError",e)}}))}function r(){p||(p=!0,c(),h.close(),h=null)}function o(t){var e=new Error("probe error: "+t);e.transport=h.name,r(),u.emit("upgradeError",e)}function i(){o("transport closed")}function s(){o("socket closed")}function a(t){h&&t.name!==h.name&&r()}function c(){h.removeListener("open",e),h.removeListener("error",o),h.removeListener("close",i),u.removeListener("close",s),u.removeListener("upgrading",a)}var h=this.createTransport(t,{probe:1}),p=!1,u=this;n.priorWebsocketSuccess=!1,h.once("open",e),h.once("error",o),h.once("close",i),this.once("close",s),this.once("upgrading",a),h.open()},n.prototype.onOpen=function(){if(this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t1?{type:b[o],data:t.substring(1)}:{type:b[o]}:k}var i=new Uint8Array(t),o=i[0],s=f(t,1);return w&&"blob"===r&&(s=new w([s])),{type:b[o],data:s}},e.decodeBase64Packet=function(t,e){var r=b[t.charAt(0)];if(!h)return{type:r,data:{base64:!0,data:t.substr(1)}};var n=h.decode(t.substr(1));return"blob"===e&&w&&(n=new w([n])),{type:r,data:n}},e.encodePayload=function(t,r,n){function o(t){return t.length+":"+t}function i(t,n){e.encodePacket(t,!!s&&r,!1,function(t){n(null,o(t))})}"function"==typeof r&&(n=r,r=null);var s=u(t);return r&&s?w&&!g?e.encodePayloadAsBlob(t,n):e.encodePayloadAsArrayBuffer(t,n):t.length?void c(t,i,function(t,e){return n(e.join(""))}):n("0:")},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);"function"==typeof r&&(n=r,r=null);var o;if(""===t)return n(k,0,1);for(var i,s,a="",c=0,h=t.length;c0;){for(var s=new Uint8Array(o),a=0===s[0],c="",h=1;255!==s[h];h++){if(c.length>310)return n(k,0,1);c+=s[h]}o=f(o,2+c.length),c=parseInt(c);var p=f(o,0,c);if(a)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(t){var u=new Uint8Array(p);p="";for(var h=0;hn&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(r-e),s=e,a=0;s=55296&&e<=56319&&o65535&&(e-=65536,o+=k(e>>>10&1023|55296),e=56320|1023&e),o+=k(e);return o}function c(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function h(t,e){return k(t>>e&63|128)}function p(t,e){if(0==(4294967168&t))return k(t);var r="";return 0==(4294965248&t)?r=k(t>>6&31|192):0==(4294901760&t)?(c(t,e)||(t=65533),r=k(t>>12&15|224),r+=h(t,6)):0==(4292870144&t)&&(r=k(t>>18&7|240),r+=h(t,12),r+=h(t,6)),r+=k(63&t|128)}function u(t,e){e=e||{};for(var r,n=!1!==e.strict,o=s(t),i=o.length,a=-1,c="";++a=v)throw Error("Invalid byte index");var t=255&g[b];if(b++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(t){var e,r,n,o,i;if(b>v)throw Error("Invalid byte index");if(b==v)return!1;if(e=255&g[b],b++,0==(128&e))return e;if(192==(224&e)){if(r=f(),i=(31&e)<<6|r,i>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if(r=f(),n=f(),i=(15&e)<<12|r<<6|n,i>=2048)return c(i,t)?i:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(r=f(),n=f(),o=f(),i=(7&e)<<18|r<<12|n<<6|o,i>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}function d(t,e){e=e||{};var r=!1!==e.strict;g=s(t),v=g.length,b=0;for(var n,o=[];(n=l(r))!==!1;)o.push(n);return a(o)}var y="object"==typeof e&&e,m=("object"==typeof t&&t&&t.exports==y&&t,"object"==typeof o&&o);m.global!==m&&m.window!==m||(i=m);var g,v,b,k=String.fromCharCode,w={version:"2.1.2",encode:u,decode:d};n=function(){return w}.call(e,r,e,t),!(void 0!==n&&(t.exports=n))}(this)}).call(e,r(24)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n>2],i+=t[(3&n[r])<<4|n[r+1]>>4],i+=t[(15&n[r+1])<<2|n[r+2]>>6],i+=t[63&n[r+2]];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,n,o,i,s,a=.75*t.length,c=t.length,h=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),u=new Uint8Array(p);for(e=0;e>4,u[h++]=(15&o)<<4|i>>2,u[h++]=(3&i)<<6|63&s;return p}}()},function(t,e){(function(e){function r(t){for(var e=0;e0);return e}function n(t){var e=0;for(p=0;p';i=document.createElement(t)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),p=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=p,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),n(),t=t.replace(h,"\\\n"),this.area.value=t.replace(c,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&r()}:this.iframe.onload=r}}).call(e,function(){return this}())},function(t,e,r){(function(e){function n(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=p&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(u=o),i.call(this,t)}var o,i=r(18),s=r(19),a=r(27),c=r(28),h=r(29),p=(r(3)("engine.io-client:websocket"),e.WebSocket||e.MozWebSocket);if("undefined"==typeof window)try{o=r(32)}catch(t){}var u=p;u||"undefined"!=typeof window||(u=o),t.exports=n,c(n,i),n.prototype.name="websocket",n.prototype.supportsBinary=!0,n.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={agent:this.agent,perMessageDeflate:this.perMessageDeflate};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new u(t,e):new u(t):new u(t,e,r)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},n.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},n.prototype.write=function(t){function r(){n.emit("flush"),setTimeout(function(){n.writable=!0,n.emit("drain")},0)}var n=this;this.writable=!1;for(var o=t.length,i=0,a=o;i0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=r,r.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-r:t+r}return 0|Math.min(t,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(t){this.ms=t},r.prototype.setMax=function(t){this.max=t},r.prototype.setJitter=function(t){this.jitter=t}}])});
var nc_sid;
var nc_name;
var wplc_cid;
var socket;
var FADE_TIME=150;
var TYPING_TIMER_LENGTH=1000;
var username=config.wplc_user_default_visitor_name;
var connected=false;
var typing=false;
var lastTypingTime;
var nifty_is_chat_open=false;
var nifty_chat_status="browsing";
var tcx_show_drag_zone=false;
var tcx_msg_confirmations={};
var tcx_recent_agents=undefined;
var tcx_recent_agents_data=undefined;
var query_string="";
var tcx_customerID=null;
var tcx_fingerprint=null;
var wplc_chat_delegates;
var wplc_connect;
var tcx_ping=new Audio(config.message_override);
var tcx_inactive=false;
var tcx_inactive_timeout;
var tcx_timeout_duration=300000;
var tcxAverageResponseTime=undefined;
var agent_disc_timer=[];
var agent_joined=[];
var user_hearbeat;
var wplc_online=false;
var nifty_is_minimized=false;
var selectedIndexStart;
var selectedIndexEnd;
var checkSelection=true;
var niftyIsEditing=false;
var lastmessagesent;
var nifty_welcome_message_sent=false;
var $inputMessage='';
var $messages='';
var tcx_first;
var tcx_current;
var tcx_user_current_os=false;
function wplc_jsguid(){
var nav=window.navigator;
var screen=window.screen;
var guid=nav.mimeTypes.length;
guid +=nav.userAgent.replace(/\D+/g, '');
guid +=nav.plugins.length;
guid +=screen.height||'';
guid +=screen.width||'';
guid +=screen.pixelDepth||'';
return guid;
};
function wplc_set_up_query_string(){
if(typeof wplc_guid!=="undefined"){
query_string +="&guid=" + wplc_guid;
}
if(typeof tcx_user_ip_address!=="undefined"){
query_string +="&user_ip=" + tcx_user_ip_address;
}
tcx_customerID=wplc_getCookie('tcx_customerID');
if(typeof tcx_customerID!=="undefined"&&tcx_customerID!==''&&tcx_customerID!==null){
query_string +="&customer_id=" + tcx_customerID;
}
tcx_fingerprint=wplc_jsguid();
if(typeof tcx_fingerprint!=="undefined"&&tcx_fingerprint!==''&&tcx_fingerprint!==null){
query_string +="&tcx_fingerprint=" + tcx_fingerprint;
}
if(typeof window!=="undefined"&&typeof window.location!=="undefined"&&typeof window.location.href!=="undefined"){
query_string +="&referer=" + window.location.href;
}
query_string=wplc_query_cleanup(query_string);
}
jQuery(document).on('wplc_sockets_ready', function(){
wplc_set_up_query_string();
wplc_powered_by();
tcx_inactive_timeout=setTimeout(function(){
tcx_inactive=true;
}, tcx_timeout_duration);
if(wplc_test_localStorage()){
var wplc_d=new Date();
wplc_d.toUTCString();
var cdatetime=Math.floor(wplc_d.getTime() / 1000);
if(localStorage.getItem('tcx_first')===null){
localStorage.setItem('tcx_first', cdatetime);
tcx_first=cdatetime;
}else{
tcx_first=localStorage.getItem('tcx_first');
}
localStorage.setItem('tcx_current', cdatetime);
tcx_current=cdatetime;
}
if(typeof ns_obj==='undefined'){
}else{
if(ns_obj.o==='1'){
wplc_online=true;
}else{
wplc_run=false;
wplc_online=false;
}}
wplc_check_minimize_cookie=Cookies.get('nifty_minimize');
wplc_chat_delegates=function(keepalive){
nifty_chat_status_temp=nc_getCookie("nc_status");
if(typeof nifty_chat_status_temp!=="undefined"&&nifty_chat_status_temp==="active"){
}else{
if(keepalive){
niftyUpdateStatusCookie("active");
}else{
niftyUpdateStatusCookie("browsing");
}}
nifty_username_temp=nc_getCookie("nc_username");
if(typeof nifty_username_temp!=="undefined"){
username=nifty_username_temp;
}
socket.on('connect', function(data){
nc_add_user(socket, data);
nifty_chat_status_temp=nc_getCookie("nc_status");
if(typeof nifty_chat_status_temp!=="undefined"&&nifty_chat_status_temp==="active"){
if(typeof user_hearbeat==="undefined"){
user_hearbeat=setInterval(function(){
if(socket.connected)
socket.emit('heartbeat');
}, 5000);
}}
jQuery.event.trigger({
type: 'tcx_socket_connected',
status: nifty_chat_status_temp
});
});
socket.on("force_disconnect", function(data){
socket.disconnect({
test: 'test'
});
if(typeof user_heartbeat!=="undefined")
clearInterval(user_hearbeat);
user_heartbeat=undefined;
setTimeout(function(){
wplc_connect(false);
}, 12000);
});
socket.on("blacklisted", function(data){
jQuery.event.trigger({
type: "tcx_blacklisted",
ndata: data
});
});
socket.on("user blocked", function(data){
socket.disconnect({
blocked: 'blocked'
});
CookieDate.setFullYear(CookieDate.getFullYear() + 1);
Cookies.set('tcx_b', '1', {
expires: CookieDate,
path: '/'
});
jQuery("#wp-live-chat-4").remove();
jQuery("#wp-live-chat-wraper").remove();
keepalive=false;
});
socket.on("customerID", function(data){
var CookieDate=new Date;
CookieDate.setFullYear(CookieDate.getFullYear() + 1);
Cookies.set('tcx_customerID', data.customerID, {
expires: CookieDate,
path: '/'
});
});
socket.on("agent initiate", function(data){
if(typeof user_hearbeat==="undefined"){
socket.emit('initiate received', {
chatid: wplc_cid
});
var anti_cache=Date.now();
var sdata={ cid: wplc_cid, server_token: wplc_restapi_token, _wpnonce: wplc_restapi_nonce };
wplc_send_url=wplc_restapi_endpoint + "/start_session?nocache=" + anti_cache;
jQuery.ajax({
url: wplc_send_url,
data: sdata,
type: "POST",
timeout: 12000,
success: function(response){
console.log(response);
},
error: function(error){
console.log(error);
},
});
user_hearbeat=setInterval(function(){
if(socket.connected){
socket.emit('heartbeat');
}}, 5000);
}
niftyUpdateStatusCookie('active');
jQuery.event.trigger({
type: "tcx_agent_initiated_chat",
ndata: data
});
});
socket.on('message received', function(data){
if(typeof data!=='undefined'){
if(typeof data.msgID!=='undefined'&&typeof data.outcome!=='undefined'){
tcx_msg_confirmations[data.msgID]=data.outcome;
}}
});
socket.on('message read received', function(data){
jQuery.event.trigger({
type: "tcx_message_read_received",
ndata: data
});
});
socket.on('agent to participant ping', function(data){
socket.emit('agent to participant ping received', {
fromsocket: socket.id,
intendedsocket: data.fromsocket,
chatid: data.chatid
});
});
socket.on("chat ended", function(data){
jQuery.event.trigger({
type: "tcx_chat_ended_notification",
ndata: data
});
var sdata={ cid: wplc_cid };
wplc_rest_api('end_session', sdata, 12000, null);
jQuery("#tcx_chat_ended").show();
tcx_end_chat_div_create();
if(typeof user_heartbeat!=="undefined"){
clearInterval(user_heartbeat);
user_heartbeat=undefined;
}
socket.disconnect({
test: 'test'
});
niftyUpdateStatusCookie('browsing');
if(typeof io!=="undefined"){
wplc_set_up_query_string();
socket=io.connect(WPLC_SOCKET_URI, {
query: query_string,
transports: ['websocket']
});
wplc_chat_delegates();
}
if(typeof Cookies!=="undefined"){
Cookies.remove("wplc_cid");
}});
socket.on("averageResponse", function(data){
jQuery.event.trigger({
type: "tcx_average_response",
ndata: data
});
});
socket.on("recent_agents", function(data){
if(typeof data!=="undefined"&&typeof data.agents!=="undefined"){
tcx_recent_agents=data.agents;
}});
socket.on("agent_data", function(data){
if((typeof data!=="undefined"&&data!==null)&&(typeof data.ndata!=="undefined"&&data.ndata!==null)&&(typeof data.ndata.aid!=='undefined'&&data.ndata.aid!==null)){
if(typeof tcx_recent_agents_data==="undefined"){
tcx_recent_agents_data={};
tcx_recent_agents_data[data.ndata.aid]=data.ndata;
}else{
tcx_recent_agents_data[data.ndata.aid]=data.ndata;
}}
});
socket.on("transfer chat", function(data){
addNotice({
message: 'You are being transferred to another agent. Please be patient.'
});
});
socket.on("location found", function(data){
tcx_location_info=data;
});
socket.on('chat history', function(data){
jQuery.event.trigger({
type: "tcx_chat_history",
ndata: data
});
});
socket.on('login', function(data){
connected=true;
if(keepalive){
var message="Connection established";
}});
socket.on('new message', function(data){
socket.emit('message read', data);
jQuery.event.trigger({
type: "tcx_new_message",
ndata: data
});
if(!!wplc_enable_ding.value){
tcx_ping.play();
}
jQuery('#tcx_chat_ended').hide();
});
socket.on('user chat notification', function(data){
jQuery.event.trigger({
type: "tcx_user_chat_notification",
ndata: data
});
});
socket.on('custom data received', function(data){
jQuery.event.trigger({
type: "tcx_custom_data_received",
ndata: data
});
});
socket.on('socketid', function(socketid){
document.cookie="nc_sid=" + socketid.socketid;
if(!wplc_online){}});
socket.on('agent joined', function(data){
clearTimeout(agent_disc_timer[data.agent]);
jQuery.event.trigger({
type: "tcx_agent_joined",
ndata: data
});
jQuery('.tmp-welcome-msg').remove();
});
socket.on('new_socket', function(socketid){});
socket.on('agent left', function(data){
jQuery.event.trigger({
type: "tcx_agent_left",
ndata: data
});
});
socket.on('agent connected', function(data){
clearTimeout(agent_disc_timer[data.aid]);
})
socket.on('agent disconnected', function(data){
agent_disc_timer[data.aid]=setTimeout(function(){
jQuery.event.trigger({
type: "tcx_agent_disconnected",
ndata: data
});
removeChatTyping(data);
}, 8000);
});
socket.on('typing', function(data){
jQuery.event.trigger({
type: "tcx_typing",
ndata: data
});
});
socket.on('stop typing', function(data){
jQuery.event.trigger({
type: "tcx_stop_typing",
ndata: data
});
});
socket.on('chatID', function(data){
Cookies.set('wplc_cid', data.chatid, {
expires: 1,
path: '/'
});
wplc_cid=data.chatid;
if(!nifty_is_chat_open){
nifty_init_chat_box_check(data.chatid);
}});
socket.on("involved check returned", function(data){
jQuery.event.trigger({
type: 'tcx_build_involved_agents_header',
ndata: data
});
});
socket.on('disconnect', function(){
if(typeof user_heartbeat!=="undefined")
clearInterval(user_heartbeat);
user_heartbeat=undefined;
if(keepalive){
jQuery.event.trigger({
type: "tcx_disconnected"
});
}});
socket.on('reconnect', function(){
if(keepalive){
jQuery.event.trigger({
type: "tcx_reconnect"
});
}
nc_add_user(socket, '');
});
socket.on('reconnect_error', function(){
jQuery.event.trigger({
type: "tcx_reconnect_error"
});
});
socket.on('a2vping', function(data){
socket.emit('a2vping return', {
fromsocket: socket.id,
intendedsocket: data.returnsocket,
chatid: data.chatid
});
})
}
$messages=jQuery('#wplc_chatbox');
$inputMessage=jQuery('#wplc_chatmsg');
jQuery("#nifty_file_input").on("change", function(){
var file=this.files[0];
wplcShareFile(file, '#nifty_attach_fail_icon', '#nifty_attach_success_icon', '#nifty_attach_uploading_icon', "#nifty_select_file");
jQuery("#chat_drag_zone").fadeOut();
this.value="";
});
try {
document.getElementById('wplc_chatmsg').onpaste=function(event){
var items=(event.clipboardData||event.originalEvent.clipboardData).items;
var blob=null;
for (var i=0; i < items.length; i++){
if(items[i].type.indexOf("image")===0){
blob=items[i].getAsFile();
}}
if(blob!==null){
var reader=new FileReader();
reader.onload=function(event){
document.getElementById("wplc_chatmsg").value="####" + event.target.result + "####";
jQuery("#wplc_send_msg").click();
};
reader.readAsDataURL(blob);
}}
} catch (ex){}
jQuery("#nifty_tedit_b").click(function(){
niftyTextEdit("b");
});
jQuery("#nifty_tedit_i").click(function(){
niftyTextEdit("i");
});
jQuery("#nifty_tedit_u").click(function(){
niftyTextEdit("u");
});
jQuery("#nifty_tedit_strike").click(function(){
niftyTextEdit("strike");
});
jQuery("#nifty_tedit_mark").click(function(){
niftyTextEdit("mark");
});
jQuery("#nifty_tedit_sub").click(function(){
niftyTextEdit("sub");
});
jQuery("#nifty_tedit_sup").click(function(){
niftyTextEdit("sup");
});
jQuery("#nifty_tedit_link").click(function(){
niftyTextEdit("link");
});
/*
setInterval(function(){
getText(document.getElementById("wplc_chatmsg"));
}, 1000);
*/
sid=nc_getCookie("wplc_sid");
nifty_chat_status_temp=nc_getCookie("nc_status");
if(nifty_chat_status_temp!=="undefined"){
nifty_chat_status=nifty_chat_status_temp;
}
chatid=nc_getCookie("wplc_cid");
if(chatid!=="undefined"){
wplc_cid=chatid;
nc_name=nc_getCookie("nc_username");
}
if(window.console){
console.log("[WPLC] Connecting to " + WPLC_SOCKET_URI);
}
var tcx_b=wplc_getCookie('tcx_b');
if(typeof tcx_b!=="undefined"&&tcx_b==='1'){
console.log("[WPLC] You have been blocked from using WP Live Chat by 3CX");
return;
}else{
wplc_wait_for_socketio();
wplc_chat_delegates();
}
function wplc_wait_for_socketio(){
if(typeof io!=="undefined"){
wplc_set_up_query_string();
socket=io.connect(WPLC_SOCKET_URI, {
query: query_string,
transports: ['websocket']
});
}else{
setTimeout(wplc_wait_for_socketio(), 100);
}}
wplc_connect=function(keepalive){
if(tcx_inactive===false&&wplc_online){
if(typeof socket!=="undefined"){
if(socket.connected){
}else{
wplc_set_up_query_string();
socket=io.connect(WPLC_SOCKET_URI, {
query: query_string,
transports: ['websocket']
});
wplc_chat_delegates(keepalive);
}}else{
wplc_set_up_query_string();
socket=io.connect(WPLC_SOCKET_URI, {
query: query_string,
transports: ['websocket']
});
wplc_chat_delegates(keepalive);
}}else{
setTimeout(function(){
if(socket.connected){}else{
wplc_connect(false);
}}, 7000);
}}
var $window=jQuery(window);
var message_preview_currently_being_typifcationed;
jQuery(document).on('mousemove', function(){
clearTimeout(tcx_inactive_timeout);
tcx_inactive=false;
tcx_inactive_timeout=setTimeout(function(){
tcx_inactive=true;
}, tcx_timeout_duration);
});
document.addEventListener('tcx_send_message', function(e){
if(typeof wplc_online!=='undefined'&&wplc_online===true){
socket.emit('stop typing', {
chatid: wplc_cid
});
}
typing=false;
niftyIsEditing=false;
}, false);
jQuery(document).on("tcx_send_message", function(e){
if(typeof wplc_online!=='undefined'&&wplc_online===true){
socket.emit('stop typing', {
chatid: wplc_cid
});
}
typing=false;
niftyIsEditing=false;
});
jQuery(document).on("keydown", "#wplc_chatmsg", function(event){
if(event.which===13&&!event.shiftKey){
if(jQuery(this).val().trim()!==''){
event.preventDefault();
jQuery("#wplc_send_msg").click();
}}else if(event.which===27&&!event.shiftKey){
jQuery("#wplc_chatmsg").val('');
niftyIsEditing=false;
}});
$inputMessage.keyup(function(event){
if(event.which===13&&!event.shiftKey){}else{
if(config.enable_typing_preview==1&&typeof wplc_online!=='undefined'&&wplc_online===true){
socket.emit('typing_preview', {
chatid: wplc_cid,
tempmessage: $inputMessage.val()
});
}}
});
$inputMessage.on('input', function(){
updateTyping();
});
$inputMessage.click(function(){
$inputMessage.focus();
});
jQuery(document).on("click", ".tcx_restart_chat", function(){
jQuery("#wp-live-chat-header").click();
jQuery(".wplc_agent_info").html('');
setTimeout(function(){
jQuery("#wp-live-chat-header").click();
}, 100);
jQuery('#wplc_end_chat_button').show();
jQuery('#wplc_end_chat_button').removeAttr('wplc_disable');
});
jQuery(document).on("click", "#wplc_send_msg", function(){
var message=$inputMessage.val();
if(message.length > 2000){
message=message.substring(0, 2000);
}
sendMessage(message);
});
jQuery(document).on("nifty_trigger_open_chat", function(event){
open_chat();
jQuery("#tcx_chat_ended").hide();
});
jQuery(document).on("tcx_socket_connected", function(e){
if(typeof socket!=="undefined"&&typeof nifty_chat_status!=="undefined"){
if(nifty_chat_status==="active"){
socket.emit('check involved agents', {
chatid: chatid
});
}}
});
jQuery(document).on("wplc_animation_done", function(event){
if(typeof wdtEmojiBundle!=="undefined"){
wdtEmojiBundle.defaults.emojiSheets={
'apple': wplc_baseurl + 'js/vendor/wdt-emoji/sheets/sheet-apple-64-indexed-128.png',
'google': wplc_baseurl + 'js/vendor/wdt-emoji/sheets/sheet-google-64-indexed-128.png',
'twitter': wplc_baseurl + 'js/vendor/wdt-emoji/sheets/sheet-twitter-64-indexed-128.png',
'emojione': wplc_baseurl + 'js/vendor/wdt-emoji/sheets/sheet-emojione-64-indexed-128.png',
'facebook': wplc_baseurl + 'js/vendor/wdt-emoji/sheets/sheet-facebook-64-indexed-128.png',
'messenger': wplc_baseurl + 'js/vendor/wdt-emoji/sheets/sheet-messenger-64-indexed-128.png'
};
tcx_attempt_emoji_input_init(0);
}});
jQuery("#wp-live-chat-minimize").on("click", function(){
jQuery.event.trigger({
type: "nifty_minimize_chat"
});
Cookies.set('nifty_minimize', "yes", {
expires: 1,
path: '/'
});
nifty_is_minimized=true;
});
jQuery("#wplc_start_chat_btn").on("click", function(){
jQuery("#wplc_name").removeClass('wplc_error_field');
jQuery("#wplc_email").removeClass('wplc_error_field');
jQuery("#wplc_chat_gdpr_opt_in").removeClass('incomplete');
document.getElementById('wplc_name').title='';
document.getElementById('wplc_email').title='';
var formOk=true;
var wplc_is_gdpr_enabled=jQuery(this).attr('data-wplc-gdpr-enabled');
if(typeof wplc_is_gdpr_enabled!=="undefined"&&(wplc_is_gdpr_enabled==='true')){
var wplc_gdpr_opt_in_checked=jQuery("#wplc_chat_gdpr_opt_in").is(':checked');
if(typeof wplc_gdpr_opt_in_checked==="undefined"||wplc_gdpr_opt_in_checked===false){
jQuery("#wplc_chat_gdpr_opt_in").addClass('incomplete');
formOk=false;
}}
var wplc_name=jQuery("#wplc_name").val().replace(/(<([^>]+)>)/ig, "");
var wplc_email=jQuery("#wplc_email").val().replace(/(<([^>]+)>)/ig, "");
if(wplc_name.length <=0){
jQuery("#wplc_name").addClass('wplc_error_field');
document.getElementById('wplc_name').title=wplc_error_messages.please_enter_name;
formOk=false;
}
if(wplc_email.length <=0){
jQuery("#wplc_email").addClass('wplc_error_field');
document.getElementById('wplc_email').title=wplc_error_messages.please_enter_email;
formOk=false;
}else{
if(jQuery("#wplc_email").attr('wplc_hide')!=="1"){
var testEmail=/^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,6}$/i;
if(!testEmail.test(wplc_email)){
document.getElementById('wplc_email').title=wplc_error_messages.please_enter_valid_email;
jQuery("#wplc_email").addClass('wplc_error_field');
formOk=false;
}}
}
if(!formOk){
return false;
}
jQuery.event.trigger({
type: "nifty_trigger_start_chat"
});
var date=new Date();
date.setTime(date.getTime() + (2 * 60 * 1000));
niftyUpdateUserDataCookies(wplc_name, wplc_email);
niftyUpdateGravCookie(md5(wplc_email));
niftyUpdateStatusCookie("active");
wplc_connect(true);
var request_chat_checker=setInterval(function(){
if(typeof socket!=="undefined"&&typeof socket.connected!=="undefined"&&socket.connected===true){
clearInterval(request_chat_checker);
socket.emit("request chat", {
chatid: wplc_cid,
name: wplc_name,
email: wplc_email
});
}else{
}}, 300);
});
});
function log(message, options){
var $el=jQuery('').addClass('log').text(message);
addMessageElement($el, options);
}
function addNotice(data, options){
options=options||{};
var new_item="";
if(options.is_admin){
new_item +="";
}else{
new_item +="";
}
var $messageBodyDiv=jQuery('').html(wplcFormatParser(data.message));
var $messageDiv=jQuery(new_item).append($messageBodyDiv);
addMessageElement($messageDiv, options);
}
function removeChatTyping(data){
getTypingMessages(data).fadeOut(function(){
jQuery(this).remove();
});
}
function addMessageElement(el, options){
var $el=jQuery(el);
if(!options){
options={};}
if(typeof options.fade==='undefined'){
options.fade=true;
}
if(typeof options.prepend==='undefined'){
options.prepend=false;
}
if(options.fade){
$el.hide().fadeIn(FADE_TIME);
}
if(options.prepend){
$messages.prepend($el);
}else{
$messages.append($el);
}
$messages[0].scrollTop=$messages[0].scrollHeight;
}
function updateTyping(){
if(connected){
if(!niftyIsEditing){
if(!typing){
typing=true;
socket.emit('typing', {
chatid: wplc_cid
});
}
lastTypingTime=(new Date()).getTime();
setTimeout(function(){
var typingTimer=(new Date()).getTime();
var timeDiff=typingTimer - lastTypingTime;
if(timeDiff >=TYPING_TIMER_LENGTH&&typing){
if(typeof wplc_online!=='undefined'&&wplc_online===true){
socket.emit('stop typing', {
chatid: wplc_cid
});
}
typing=false;
}}, TYPING_TIMER_LENGTH);
}}
}
function getTypingMessages(data){
return jQuery('.typing.message').filter(function(i){
return jQuery(this).data('username')===data.username;
});
}
function sendMessage(message){
if(typeof tcx_convert_colon_to_uni!=="undefined"){
message=tcx_convert_colon_to_uni(message);
}
var randomNum=Math.floor((Math.random() * 100) + 1);
var msgID=Date.now() + randomNum;
lastmessagesent=msgID;
var ndata={
username: username,
message: message,
aoru: 'u',
msgID: msgID,
is_admin: false
}
jQuery.event.trigger({
type: "tcx_send_message",
message: message,
msg_id: msgID
});
jQuery.event.trigger({
type: "tcx_new_message",
ndata: ndata,
msgID: msgID
});
var msgObject={
message: message,
chatid: wplc_cid,
msgID: msgID,
aoru: 'u'
};
socket.emit('new message', msgObject);
tcxConfirmDelivery(msgID, msgObject);
}
function niftyUpdateStatusCookie(new_status){
Cookies.set('nc_status', new_status, {
expires: 1,
path: '/'
});
}
function niftyUpdateGravCookie(grav_hash){
Cookies.set('wplc_grav_hash', grav_hash, {
expires: 1,
path: '/'
});
wplc_cookie_grav_hash=grav_hash;
}
function niftyUpdateUserDataCookies(name, email){
Cookies.set('wplc_name', name, {
expires: 1,
path: '/'
});
Cookies.set('wplc_email', email, {
expires: 1,
path: '/'
});
wplc_cookie_name=name;
wplc_cookie_email=email;
}
var open_chat=function(force){
var tmp_cookie_val=nc_getCookie('nifty_minimize');
nifty_is_minimized=tmp_cookie_val==''||tmp_cookie_val=='false'||tmp_cookie_val==false ? false:true;
nifty_chat_status_temp=nc_getCookie("nc_status");
wplc_chat_status_temp=nc_getCookie("wplc_chat_status");
if(nifty_chat_status_temp==="active"){
niftyUpdateStatusCookie("active");
wplc_connect(true);
if(!nifty_is_minimized){
jQuery.event.trigger({
type: "nifty_trigger_open_chat_2",
wplc_online: wplc_online
});
nifty_is_chat_open=true;
}
if(!jQuery("#wp-live-chat-header").hasClass("active")){
jQuery("#wp-live-chat-header").click();
}}else if(nifty_chat_status_temp==="browsing"||wplc_chat_status_temp==="5"){
if(jQuery("#wp-live-chat-2").is(":visible")===false&&jQuery("#wp-live-chat-4").is(":visible")===false){
jQuery("#wp-live-chat-2").show();
jQuery("#wp-live-chat-header").addClass("active");
}}
}
function getText(elem){
if(checkSelection){
if(selectedIndexStart!==elem.selectionStart){
selectedIndexStart=elem.selectionStart;
}
if(selectedIndexEnd!==elem.selectionEnd){
selectedIndexEnd=elem.selectionEnd;
}}
}
function niftyTextEdit(insertContent){
if(typeof selectedIndexStart!=="undefined"&&typeof selectedIndexEnd!=="undefined"){
checkSelection=false;
jQuery("#wplc_chatmsg").focus();
var current=jQuery("#wplc_chatmsg").val();
var pre=current.substr(0, (selectedIndexStart > 0) ? selectedIndexStart:0);
var selection=current.substr(selectedIndexStart, selectedIndexEnd - selectedIndexStart);
var post=current.substr(((selectedIndexEnd < current.length) ? selectedIndexEnd:current.length), current.length);
current=pre + insertContent + ":" + selection + ":" + insertContent + post;
jQuery("#wplc_chatmsg").val(current);
checkSelection=true;
}}
function wplcShareFile(fileToUpload, failedID, successID, uploadingID, originalID){
if(fileToUpload==undefined||fileToUpload==false||fileToUpload==null){
return;
}
var formData=new FormData();
formData.append('file', fileToUpload);
formData.append('timestamp', Date.now());
formData.append('_wpnonce', wplc_restapi_nonce);
jQuery(uploadingID).show();
jQuery(originalID).hide();
jQuery(successID).hide();
jQuery(failedID).hide();
var uploadUrl='';
uploadUrl=(typeof tcx_override_upload_url!=="undefined"&&tcx_override_upload_url!=="") ? tcx_override_upload_url:uploadUrl;
if(fileToUpload.name.match(new RegExp('^.*\\.(' + config.allowed_upload_extensions + ')$', 'i'))){
if(fileToUpload.size < 8000000){
jQuery.ajax({
url: uploadUrl,
type: 'POST',
data: formData,
cache: false,
processData: false,
contentType: false,
success: function(data){
if(parseInt(data)!==0){
jQuery(uploadingID).hide();
jQuery(successID).show();
setTimeout(function(){
jQuery(successID).hide();
jQuery(originalID).show();
}, 2000);
var fileLinkUrl=false;
if(!tcxIsJson(data)){
if(typeof data!=="object"){
fileLinkUrl=data;
}else{
if(typeof data.response!=="undefined"){
fileLinkUrl=data.response;
}else{
fileLinkUrl=data;
}}
}else{
var dataPacket=JSON.parse(data);
if(typeof dataPacket.response!=="undefined"){
fileLinkUrl=dataPacket.response;
}else{
fileLinkUrl=data;
}}
if(fileLinkUrl!==false){
if(fileLinkUrl!=='Security Violation'){
tag='link';
jQuery("#wplc_chatmsg").val(tag + ":" + fileLinkUrl + ":" + tag);
jQuery("#wplc_send_msg").trigger("click");
setTimeout(function(){
$messages[0].scrollTop=$messages[0].scrollHeight;
}, 1000);
}else{
alert('Security Violation: File Not Allowed.');
}}
}else{
jQuery(uploadingID).hide();
jQuery(failedID).show();
setTimeout(function(){
jQuery(failedID).hide();
jQuery(originalID).show();
}, 2000);
}},
error: function(){
jQuery(uploadingID).hide();
jQuery(failedID).show();
setTimeout(function(){
jQuery(failedID).hide();
jQuery(originalID).show();
}, 2000);
}});
}else{
alert("File limit is 8mb");
jQuery(uploadingID).hide();
jQuery(failedID).show();
setTimeout(function(){
jQuery(failedID).hide();
jQuery(originalID).show();
}, 2000);
}}else{
alert("File type not supported.");
jQuery(uploadingID).hide();
jQuery(failedID).show();
setTimeout(function(){
jQuery(failedID).hide();
jQuery(originalID).show();
}, 2000);
}}
function tcxConfirmDelivery(msgID, msgObject){
jQuery.event.trigger({
type: 'tcx_trigger_check_message_received',
msgID: msgID,
msgObject: msgObject
});
}
function tcx_end_chat_div_create(){
jQuery('', {
'class': 'tcx_restart_chat',
href: "javascript:void(0);",
title: "Restart chat",
html: "Restart chat",
}).appendTo('#tcx_chat_ended');
}
function wplc_emoji_render(msg){
if(typeof wdtEmojiBundle!=="undefined"){
msg=wdtEmojiBundle.render(msg);
}
return msg;
}
function nc_add_user(socket, data){
var data={};
chatid=nc_getCookie("wplc_cid");
if(typeof chatid!=="undefined"){
wplc_cid=chatid;
nc_name=nc_getCookie("nc_username");
wplc_name=nc_getCookie("wplc_name");
}
var tcx_customerID=wplc_getCookie('tcx_customerID');
if(typeof tcx_customerID!=="undefined"&&tcx_customerID!==''&&tcx_customerID!==null){
data.customerID=tcx_customerID;
}
var tcx_b=wplc_getCookie('tcx_b');
if(typeof tcx_b!=="undefined"&&tcx_b==='1'){
console.log("[WPLC] You have been blocked from using WP Live Chat by 3CX");
return;
}else{
if(typeof chatid!=="undefined"){
if(typeof nc_name!=="undefined"){
data.username=nc_name;
}else{
if(typeof wplc_name!=='undefined'){
data.username=wplc_name;
}else{
data.username=config.wplc_user_default_visitor_name;
}}
data.api_key=tcx_api_key;
data.wplc_cid=chatid;
}else{
data.username=config.wplc_user_default_visitor_name;
data.api_key=tcx_api_key;
data.wplc_cid=null;
}
data.date_first=tcx_first;
data.date_current=tcx_current;
data.timezoneUTC=tcx_get_timezone();
data.device_in_use=tcx_get_device_in_use();
data.operating_system=tcx_get_operating_system();
data.location_info={ code: config.country_code, name: config.country_name };
if(typeof wplc_extra_data!=='undefined'&&typeof wplc_extra_data['wplc_user_selected_department']!=='undefined'){
data.department=wplc_extra_data['wplc_user_selected_department'];
}
nc_status=nc_getCookie("nc_status");
if(typeof nc_status==="undefined"||nc_status==="browsing"){
data.connectiontype="short";
}
socket.emit('add user', data);
}}
function nc_getCookie(name){
var value="; " + document.cookie;
var parts=value.split("; " + name + "=");
if(parts.length==2)
return parts.pop().split(";").shift();
}
function nifty_init_chat_box_check(cid){
if(typeof wplc_init_chat_box==="function"){
wplc_init_chat_box(cid);
}else{
if(typeof wplc_init_chat_box!=="undefined"&&wplc_init_chat_box!==false){
setTimeout(function(){
nifty_init_chat_box_check(cid);
}, 500);
}}
}
function tcxIsJson(str){
try {
JSON.parse(str);
} catch (e){
return false;
}
return true;
}
function wplc_test_localStorage(){
if(typeof localStorage!=='undefined'){
try {
localStorage.setItem('tcx_test', 'yes');
if(localStorage.getItem('tcx_test')==='yes'){
localStorage.removeItem('tcx_test');
return true;
}else{
return false;
}} catch (e){
return false;
}}else{
return false;
}}
function tcx_get_timezone(){
var offsetFromUTC=new Date().getTimezoneOffset();
var offsetInHours=Math.floor(offsetFromUTC / 60);
if(offsetInHours > 0){
return "-" + offsetInHours;
}else if(offsetInHours < 0){
return offsetInHours.toString().replace("-", "+");
}else{
return "0";
}}
function tcx_get_device_in_use(){
if(jQuery(window).width() < 900){
return "mobile";
}
return "desktop";
}
function tcx_get_operating_system(){
if(tcx_user_current_os===false&&typeof navigator!=="undefined"&&navigator.userAgent!=="undefined"){
var current_user_agent=navigator.userAgent;
var possibleOsList=[{
s: 'Windows 10',
r: /(Windows 10.0|Windows NT 10.0)/
}, {
s: 'Windows 8.1',
r: /(Windows 8.1|Windows NT 6.3)/
}, {
s: 'Windows 8',
r: /(Windows 8|Windows NT 6.2)/
}, {
s: 'Windows 7',
r: /(Windows 7|Windows NT 6.1)/
}, {
s: 'Windows Vista',
r: /Windows NT 6.0/
}, {
s: 'Windows Server 2003',
r: /Windows NT 5.2/
}, {
s: 'Windows XP',
r: /(Windows NT 5.1|Windows XP)/
}, {
s: 'Windows 2000',
r: /(Windows NT 5.0|Windows 2000)/
}, {
s: 'Windows ME',
r: /(Win 9x 4.90|Windows ME)/
}, {
s: 'Windows 98',
r: /(Windows 98|Win98)/
}, {
s: 'Windows 95',
r: /(Windows 95|Win95|Windows_95)/
}, {
s: 'Windows NT 4.0',
r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/
}, {
s: 'Windows CE',
r: /Windows CE/
}, {
s: 'Windows 3.11',
r: /Win16/
}, {
s: 'Android',
r: /Android/
}, {
s: 'Open BSD',
r: /OpenBSD/
}, {
s: 'Sun OS',
r: /SunOS/
}, {
s: 'Linux',
r: /(Linux|X11)/
}, {
s: 'iOS',
r: /(iPhone|iPad|iPod)/
}, {
s: 'Mac OS X',
r: /Mac OS X/
}, {
s: 'Mac OS',
r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/
}, {
s: 'QNX',
r: /QNX/
}, {
s: 'UNIX',
r: /UNIX/
}, {
s: 'BeOS',
r: /BeOS/
}, {
s: 'OS/2',
r: /OS\/2/
}, {
s: 'Search Bot',
r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
}];
for (var id in possibleOsList){
var current_os=possibleOsList[id];
if(current_os.r.test(current_user_agent)){
tcx_user_current_os=current_os.s;
return tcx_user_current_os;
}}
tcx_user_current_os="Unknown";
return tcx_user_current_os;
}else{
return tcx_user_current_os;
}}
function wplc_test_sessionStorage(){
if(typeof sessionStorage!=='undefined'){
try {
sessionStorage.setItem('tcx_test', 'yes');
if(sessionStorage.getItem('tcx_test')==='yes'){
sessionStorage.removeItem('tcx_test');
return true;
}else{
return false;
}} catch (e){
return false;
}}else{
return false;
}}
function tcx_attempt_emoji_input_init(attempt){
try {
wdtEmojiBundle.init('.wdt-emoji-bundle-enabled');
} catch (err){
if(attempt < 5){
attempt++;
setTimeout(function(){
tcx_attempt_emoji_input_init(attempt);
}, 1000);
}}
}
function wplc_query_cleanup(current_query){
if(current_query.charAt(0)==="&"){
current_query=current_query.substring(1);
}
return current_query;
}
function wplc_powered_by(){
if(typeof tcx_force_powered_by!=='undefined'&&tcx_force_powered_by===true){
var html=' WP Live Chat by 3CX';
if(jQuery("#wp-live-chat-4").length){
jQuery("#wp-live-chat-4").append(html);
}
if(jQuery("#wp-live-chat-2").length){
jQuery("#wp-live-chat-2").append(html);
}
jQuery(".wplc_powered_by").css('position', 'absolute');
jQuery(".wplc_powered_by").css('padding-left', '10px');
jQuery(".wplc_powered_by").css('bottom', '-82px');
jQuery(".wplc_powered_by").css('font-size', '10px');
jQuery(".wplc_powered_by").css('font-family', 'Roboto, sans-serif');
jQuery(".wplc_powered_by a").css('color', '#adadad');
jQuery(".wplc_powered_by a").css('font-weight', '700');
jQuery(".wplc_powered_by a").css('color', '#989898');
jQuery(".classic .wplc_powered_by").css('bottom', '0px');
jQuery(".classic #wplc_user_message_div").css('margin-bottom', '10px');
jQuery("#wp-live-chat-2 .wplc_powered_by").css('bottom', '0px');
jQuery(".wplc_powered_by").css('left', '0px');
}}
function wplc_getCookie(name){
var value="; " + document.cookie;
var parts=value.split("; " + name + "=");
if(parts.length==2)
return parts.pop().split(";").shift();
};
var agent_joined={};
jQuery(function(){
jQuery('body').on('click', '.wplc_custom_dropdown', function(){
jQuery(this).removeClass('unselected');
});
jQuery(document).on("wplc_open_chat", function(e){
jQuery("#tcx_chat_ended").html('').hide();
nc_status=Cookies.get("nc_status");
if(typeof nc_status==="undefined"||nc_status==="browsing"){
jQuery("#wp-live-chat-2").show();
jQuery("#wp-live-chat-2-inner").show();
var wplc_visitor_name=Cookies.get('wplc_name');
if(Cookies.get('wplc_email')!=="no email set"&&typeof wplc_visitor_name!=="undefined"){
jQuery("#wplc_name").val(Cookies.get('wplc_name'));
jQuery("#wplc_email").val(Cookies.get('wplc_email'));
}
jQuery("#wp-live-chat-header").addClass("active");
}else if(nc_status==="active"){
Cookies.set('wplc_minimize', "", { expires: 1, path: '/' });
jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
}});
jQuery(document).on("tcx_user_chat_notification", function(e){
if(typeof e.ndata!=="undefined"){
if(typeof e.ndata.chatid!=="undefined"&&typeof e.ndata.notification_text!=="undefined"){
if(e.ndata.chatid===wplc_cid){
the_message={};
the_message.msg=e.ndata.notification_text;
the_message.originates=0;
the_message.other={};
wplc_push_message_to_chatbox(the_message, "u", function(){
});
}}
}});
jQuery(document).on("tcx_socket_connected", function(e){
if(e.status==="active"){
jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
}
wplc_clear_system_notification();
});
jQuery(document).on("tcx_disconnected", function(){
console.log('disconnected');
if(typeof wplc_error_messages!=="undefined"&&typeof wplc_error_messages['disconnected_message']!=="undefined"){
var the_message=wplc_generate_system_notification_object(wplc_error_messages['disconnected_message'], {}, 0);
wplc_display_system_notification(the_message);
}});
jQuery(document).on("nifty_trigger_open_chat_2", function(e){
});
jQuery(document).on("wplc_init_complete", function(e){
if(wplc_online&&Cookies.get('tcx_received_msg')==="true"&&Cookies.get('nc_status')==="active"){
var data={
relay_action: 'wplc_get_messages',
security: wplc_nonce,
chat_id: wplc_cid,
limit:50,
offset:0,
received_via: 'u',
wplc_extra_data:wplc_extra_data
};
wplc_rest_api('get_messages', data, 12000, function(message_history){
if(typeof message_history!=="undefined"&&message_history&&typeof message_history.data!=="undefined"&&typeof message_history.data.messages!=="undefined"&&typeof message_history.data.messages==="object"){
message_history=message_history.data.messages;
for (var key in message_history){
var the_message=message_history[key];
the_message.mid=key;
wplc_push_message_to_chatbox(the_message,'u', function(){
wplc_scroll_to_bottom();
});
}}
});
}
var wplc_node_status_from_cookie=Cookies.get("nc_status");
if(typeof wplc_node_status_from_cookie!=="undefined"&&wplc_node_status_from_cookie==="active"){
if(typeof wplc_cbox_animation!=="undefined"){
wplc_cbox_animation();
}}
});
jQuery(document).on("tcx_new_message", function(e){
Cookies.set('tcx_received_msg', true, { expires: 1, path: '/' });
if(typeof e.ndata==="object"){
if(typeof e.ndata.message==="undefined"){ e.ndata.message=''; }
the_message={};
the_message.other={};
if(e.ndata.aoru==='u'){
the_message.originates=2;
}else{
the_message.originates=1;
the_message.other.aid=e.ndata.aoru;
}
the_message.msg=e.ndata.message;
the_message.mid=e.ndata.msgID;
var wplc_d=new Date();
the_message.other.datetime=Math.round(wplc_d.getTime() / 1000);
wplc_push_message_to_chatbox(the_message,'u', function(){
wplc_scroll_to_bottom();
});
if(Cookies.get("wplc_minimize")==='yes'&&jQuery("#tcx_bell").length > 0){
jQuery("#tcx_bell").show();
}}
});
jQuery(document).on("tcx_send_message", function(e){
var wplc_chat=e.message;
var data={
relay_action: 'wplc_user_send_msg',
security: wplc_nonce,
chat_id: wplc_cid,
message: wplc_chat,
msg_id: e.msg_id,
wplc_extra_data:wplc_extra_data
};
if(typeof wplc_chat==="string"&&wplc_chat.trim()!==""){
wplc_rest_api('send_message', data, 12000, null);
jQuery("#wplc_chatmsg").val('');
if(typeof wplc_enable_ga!=="undefined"&&wplc_enable_ga==='1'){
if(typeof ga!=="undefined"){
ga('send', {
hitType: 'event',
eventCategory: 'WP_Live_Chat_Support',
eventAction: 'Event',
eventLabel: 'User Send Message'
});
}}
}
jQuery.event.trigger({type: "wplc_update_gdpr_last_chat_id"});
});
jQuery(document).on("tcx_chat_history", function(e){
if(typeof e.ndata!=="undefined"&&e.ndata!==null){
}});
jQuery(document).on("tcx_agent_joined", function(e){
if(typeof e.ndata!=="undefined"&&typeof e.ndata==="object"){
if(typeof agent_joined[parseInt(e.ndata.agent)]==="undefined"){
the_message=wplc_generate_system_notification_object(e.ndata.agent_name+tcx_localized_strings[0], {}, 0);
wplc_push_message_to_chatbox(the_message,'u', function(){
wplc_scroll_to_bottom();
});
agent_joined[parseInt(e.ndata.agent)]=true;
}}
});
jQuery(document).on("tcx_agent_left", function(e){
if(typeof e.ndata!=="undefined"&&typeof e.ndata==="object"){
the_message=wplc_generate_system_notification_object(e.ndata.agent_name+tcx_localized_strings[1], {}, 0);
if(typeof agent_joined[parseInt(e.ndata.agent)]!=="undefined"&&agent_joined[parseInt(e.ndata.agent)]===true){
agent_joined[parseInt(e.ndata.agent)]=undefined;
wplc_push_message_to_chatbox(the_message,'u', function(){
wplc_scroll_to_bottom();
});
}
jQuery('#agent_grav_' + parseInt(e.ndata.agent)).remove();
var wplc_current_agent_names=jQuery(".wplc_agent_name").text();
var wplc_aid_group=jQuery(".wplc_agent_info").attr("aid");
if(wplc_aid_group.indexOf(parseInt(e.ndata.agent))!==-1){
wplc_aid_group=wplc_aid_group.replace(parseInt(e.ndata.agent), '');
jQuery(".wplc_agent_info").attr("aid", wplc_aid_group);
}
if(wplc_current_agent_names.indexOf(e.ndata.agent_name)!==-1){
wplc_current_agent_names=wplc_current_agent_names.replace(', ' + e.ndata.agent_name, '');
wplc_current_agent_names=wplc_current_agent_names.replace(e.ndata.agent_name + ', ', '');
jQuery(".wplc_agent_name").text(wplc_current_agent_names);
jQuery(".wplc_agent_name").attr('title', wplc_current_agent_names);
}
if(typeof wplc_enable_ga!=="undefined"&&wplc_enable_ga==='1'){
if(typeof ga!=="undefined"){
ga('send', {
hitType: 'event',
eventCategory: 'WP_Live_Chat_Support',
eventAction: 'Event',
eventLabel: 'Agent left the chat'
});
}}
}});
jQuery(document).on("tcx_chat_ended_notification", function(e){
if(typeof e.ndata!=="undefined"&&typeof e.ndata==="object"){
the_message=wplc_generate_system_notification_object(e.ndata.agent_name+tcx_localized_strings[2], {}, 0);
wplc_push_message_to_chatbox(the_message,'u', function(){
wplc_scroll_to_bottom();
});
}
jQuery("#wplc_user_typing").fadeOut("slow").remove();
if(typeof wplc_redirect_thank_you!=="undefined"&&wplc_redirect_thank_you!==null&&wplc_redirect_thank_you!==""){
window.location=wplc_redirect_thank_you;
}
if(jQuery('#wplc_gdpr_end_chat_notice_container').length > 0){
jQuery("#wplc_gdpr_end_chat_notice_container").fadeIn('fast');
}
if(typeof wplc_enable_ga!=="undefined"&&wplc_enable_ga==='1'){
if(typeof ga!=="undefined"){
ga('send', {
hitType: 'event',
eventCategory: 'WP_Live_Chat_Support',
eventAction: 'Event',
eventLabel: 'Chat Ended By Agent'
});
}}
if(typeof user_heartbeat!=="undefined"){
clearInterval(user_heartbeat);
}
user_heartbeat=undefined;
niftyUpdateStatusCookie('browsing');
nc_status='browsing';
nifty_chat_status_temp='browsing';
nifty_chat_status='browsing';
if(typeof io!=="undefined"){
socket=io.connect(WPLC_SOCKET_URI, { query:query_string, transports: ['websocket'] });
wplc_chat_delegates();
}});
jQuery(document).on("tcx_agent_disconnected", function(e){
/*the_message=wplc_generate_system_notification_object(e.ndata.agent_name+tcx_localized_strings[3], {}, 0);
if(typeof agent_joined[parseInt(e.ndata.aid)]!=="undefined"&&agent_joined[parseInt(e.ndata.aid)]===true){
agent_joined[parseInt(e.ndata.aid)]=undefined;
wplc_push_message_to_chatbox(the_message,'u', function(){
wplc_scroll_to_bottom();
});
}*/
});
jQuery(document).on("tcx_custom_data_received", function(e){
if(typeof e.ndata!=="undefined"){
if(typeof e.ndata.action!=="undefined"){
if(e.ndata.action==="send_custom_header"){
var temail='';
var tname='';
var taid='';
var ta_tagline='';
if(typeof e.ndata.ndata.email!=="undefined"){ temail=e.ndata.ndata.email; }
if(typeof e.ndata.ndata.name!=="undefined"){ tname=e.ndata.ndata.name; }
if(typeof e.ndata.ndata.aid!=="undefined"){ taid=e.ndata.ndata.aid; }
if(typeof e.ndata.ndata.tagline!=="undefined"){ ta_tagline=e.ndata.ndata.tagline; }
var data={
agent_tagline: ta_tagline,
aid: taid,
email: temail,
name: tname
}
jQuery.event.trigger({type: "wplc_agent_joined", ndata:{other:data}});
if(typeof wplc_enable_ga!=="undefined"&&wplc_enable_ga==='1'){
if(typeof ga!=="undefined"){
ga('send', {
hitType: 'event',
eventCategory: 'WP_Live_Chat_Support',
eventAction: 'Event',
eventLabel: 'Agent joined chat'
});
}}
}else if(e.ndata.action==="send_user_direct_to_page"){
if(typeof e.ndata.direction!=="undefined"){
if(typeof e.ndata.pretty_name!=="undefined"){
var notice=" ";
notice +=(typeof e.ndata.agent_name!=="undefined" ? e.ndata.agent_name:"Agent") + " ";
notice +=(typeof tcx_direct_to_page_localized_notice!=="undefined" ? tcx_direct_to_page_localized_notice:"would like to direct you to the following page: ");
notice +=wplc_safe_html(e.ndata.pretty_name) + " - " + wplc_sanitize_url(e.ndata.direction);
notice +=" ";
the_message={};
the_message.msg=notice;
the_message.originates=0;
the_message.decorateurl=true;
the_message.other={preformatted: true};
wplc_push_message_to_chatbox(the_message, "u", function(){
});
}}
}}
}});
jQuery(document).on("tcx_init_chat_box", function(){
nifty_chat_status_temp=Cookies.get("nc_status");
if(typeof nifty_chat_status_temp!=="undefined"&&nifty_chat_status_temp==="active"&&!nifty_is_minimized){
open_chat(1);
jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
}else{
wplc_init_chat_box(false, false);
}});
jQuery(document).on("nifty_trigger_start_chat", function(e){
wplc_cookie_name=Cookies.get('wplc_name');
wplc_cookie_email=Cookies.get('wplc_email');
if(typeof wplc_cookie_name=='undefined'){ var wplc_cookie_name=jQuery("#wp-live-chat").find("#wplc_name").val().replace(/(<([^>]+)>)/ig,""); }
if(typeof wplc_cookie_email=='undefined'){ var wplc_cookie_email=jQuery("#wp-live-chat").find("#wplc_email").val().replace(/(<([^>]+)>)/ig,""); }
wplc_send_welcome_message();
var start_data={
relay_action: 'wplc_new_chat',
security: wplc_nonce,
cid: wplc_cid,
wplc_name: wplc_cookie_name,
wplc_email: wplc_cookie_email,
wplc_extra_data: {},
url:window.location.href,
session:wplc_session_variable
};
if(typeof wplc_start_chat_pro_custom_fields_filter!=="undefined"&&typeof wplc_start_chat_pro_custom_fields_filter==="function"){
wplc_start_chat_pro_custom_fields_filter(wplc_extra_data, start_data, function(passed_extra_data, passed_action_data){
wplc_rest_api('start_chat', passed_action_data, 12000, null);
});
}else{
start_data["wplc_extra_data"]=wplc_extra_data;
wplc_rest_api('start_chat', start_data, 12000, null);
}
jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
if(typeof wplc_enable_ga!=="undefined"&&wplc_enable_ga==='1'){
if(typeof ga!=="undefined"){
ga('send', {
hitType: 'event',
eventCategory: 'WP_Live_Chat_Support',
eventAction: 'Event',
eventLabel: 'Start Chat'
});
}}
});
if(typeof wplc_elem_trigger!='undefined'){
if(wplc_elem_trigger.id!=""){
try {
var wplc_click_or_hover=parseInt(wplc_elem_trigger.action);
var wplc_class_or_id=parseInt(wplc_elem_trigger.type);
jQuery((wplc_class_or_id==1 ? "#":".") + wplc_elem_trigger.id).on((wplc_click_or_hover==1 ? "mouseenter":"click"), function(){
open_chat(0);
});
} catch (e){
console.log("WPLC Error: \"" + (wplc_class_or_id==1 ? "#":".") + wplc_elem_trigger.id + "\" is not a valid selector");
}}
}
jQuery(document).on("wplc_end_chat_as_user", function(e){
if(typeof socket!=="undefined"){
socket.emit('end chat', {chatid:chatid,agent:false,agent_name:'User', visitor_socket: socket.id});
}
jQuery("#wplc_chatbox").html("");
Cookies.remove('wplc_chat_status');
Cookies.remove('wplc_cid');
data={ 'agent_name':'User'};
jQuery.event.trigger({type: "tcx_chat_ended_notification", ndata:data});
jQuery('#tcx_chat_ended').show();
jQuery('.tcx_restart_chat').remove();
tcx_end_chat_div_create();
if(typeof user_heartbeat!=="undefined"){
clearInterval(user_heartbeat);
}
user_heartbeat=undefined;
niftyUpdateStatusCookie('browsing');
nc_status='browsing';
nifty_chat_status_temp='browsing';
nifty_chat_status='browsing';
if(typeof io!=="undefined"){
socket=io.connect(WPLC_SOCKET_URI, { query:query_string, transports: ['websocket'] });
wplc_chat_delegates();
}
if(typeof wplc_enable_ga!=="undefined"&&wplc_enable_ga==='1'){
if(typeof ga!=="undefined"){
ga('send', {
hitType: 'event',
eventCategory: 'WP_Live_Chat_Support',
eventAction: 'Event',
eventLabel: 'User End Chat'
});
}}
});
});
jQuery(document).on("tcx_agent_left", function(e){
var taid=jQuery(".wplc_agent_info").attr('aid');
if(taid==e.ndata.agent){
jQuery(".wplc_agent_info").html("");
wplc_animate_agent_header_down();
jQuery("#wplc_chatbox").css("top","18px");
}});
jQuery(document).on("wplc_minimize_chat", function(e){
wplc_is_chat_open=false;
jQuery('#wp-live-chat').height("");
if(jQuery("#wp-live-chat").attr("original_pos")==="bottom_right"){
jQuery("#wp-live-chat").css("left", "");
jQuery("#wp-live-chat").css("bottom", "0");
jQuery("#wp-live-chat").css("right", "20px");
}else if(jQuery("#wp-live-chat").attr("original_pos")==="bottom_left"){
jQuery("#wp-live-chat").css("left", "20px");
jQuery("#wp-live-chat").css("bottom", "0");
jQuery("#wp-live-chat").css("right", "");
}else if(jQuery("#wp-live-chat").attr("original_pos")==="left"){
jQuery("#wp-live-chat").css("left", "20px");
jQuery("#wp-live-chat").css("bottom", "100px");
}else if(jQuery("#wp-live-chat").attr("original_pos")==="right"){
}
jQuery('#wp-live-chat').addClass("wplc_close");
jQuery('#wp-live-chat').removeClass("wplc_open");
jQuery("#wp-live-chat").css("top", "");
jQuery("#wp-live-chat").css("height", "");
jQuery("#wp-live-chat-1").show();
jQuery("#wp-live-chat-1").css('cursor', 'pointer');
jQuery("#wp-live-chat-2").hide();
jQuery("#wp-live-chat-3").hide();
jQuery("#wp-live-chat-4").hide();
jQuery("#nifty_ratings_holder").hide();
jQuery("#nifty_ratings_holder").hide();
jQuery("#wp-live-chat-react").hide();
jQuery("#wp-live-chat-minimize").hide();
jQuery("#wp-live-chat-header").show();
});
jQuery(document).on("wplc_start_chat", function(e){
jQuery("#wp-live-chat-2-inner").hide("slow");
jQuery.event.trigger({type: "wplc_open_chat_1"});
jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
});
jQuery(document).on("wplc_open_chat_1", function(e){
jQuery('#wp-live-chat').removeClass("wplc_close");
jQuery('#wp-live-chat').addClass("wplc_open");
jQuery("#wp-live-chat-react").hide();
Cookies.set('wplc_hide', "", { expires: 1, path: '/' });
jQuery("#wp-live-chat-minimize").show();
});
jQuery(document).on("wplc_agent_joined", function(e){
var temail='';
var tname='';
var taid='';
var ta_tagline='';
if(typeof e.ndata.other.email!=="undefined"){ temail=e.ndata.other.email; }
if(typeof e.ndata.other.name!=="undefined"){ tname=wplc_safe_html(e.ndata.other.name); }
if(typeof e.ndata.other.aid!=="undefined"){ taid=parseInt(e.ndata.other.aid); }
if(typeof e.ndata.other.agent_tagline!=="undefined"&&jQuery('.wplc_agent_tagline').length==0){ ta_tagline='' + e.ndata.other.agent_tagline + ''; }
if(!isNaN(taid)){
jQuery(".wplc_no_answer").remove();
jQuery(".admin_chat_name").html(tname);
wplc_node_pair_name=tname;
wplc_agent_name=tname;
var timageurl=wplc_user_avatars[taid];
if(jQuery(".wplc_agent_info").html().trim()===""||typeof jQuery(".wplc_agent_info").attr("aid")==="undefined"){
jQuery(".wplc_agent_info").html('');
jQuery(".wplc_agent_info").attr("aid",taid);
if(! jQuery('#agent_grav_'+taid).length){
jQuery('', {
'class': '',
'style': 'text-align:center;',
html: '
'+tname+''+ta_tagline
}).appendTo('.wplc_agent_info');
jQuery('', {
'class': 'tcx_pullup down',
'title': config.wplc_text_minimizechat,
html: ''
}).appendTo('.wplc_agent_info');
jQuery('', {
'id': 'wplc_end_chat_button',
'title': config.wplc_text_endchat,
html: ''
}).appendTo('.wplc_agent_info');
}
jQuery("#wplc_chatbox").css("top",
jQuery("#wplc_chatbox_header").height()+18+"px"
);
}else{
var wplc_tracked_agents=jQuery(".wplc_agent_info").attr("aid");
var wplc_tracked_agents_object=wplc_tracked_agents.split(",");
var wplc_tracked_agent_match=false;
for(var i in wplc_tracked_agents_object){
var wplc_indexed_agent_id=parseInt(wplc_tracked_agents_object[i]);
if(wplc_indexed_agent_id===taid){
wplc_tracked_agent_match=true;
}}
if(!wplc_tracked_agent_match){
wplc_tracked_agents +="," + taid;
jQuery(".wplc_agent_info").attr("aid", wplc_tracked_agents);
var wplc_current_agent_names=jQuery(".wplc_agent_name").text();
jQuery(".wplc_agent_name").text(wplc_current_agent_names + ", " + tname);
jQuery(".wplc_agent_name").attr('title', wplc_current_agent_names + ", " + tname);
jQuery(".wplc_agent_tagline").hide();
jQuery(".wplc_agent_social_links").hide();
jQuery("img.wplc_agent_involved").removeClass("wplc_thumb32").addClass("wplc_thumb16_stacked");
var wplc_new_agent_grav='';
jQuery(wplc_new_agent_grav).insertAfter("img.wplc_agent_involved:last");
jQuery("#wplc_chatbox_header").css("max-height", jQuery("#wplc_chatbox_header").outerHeight());
jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+"px");
}}
}});
jQuery(document).on("tcx_build_involved_agents_header", function(e){
if(typeof e.ndata!=="undefined"){
if(typeof e.ndata.chatid!=="undefined"&&typeof e.ndata.agents!=="undefined"){
if(e.ndata.chatid===chatid){
var agent_match=e.ndata.agents;
for(var i in agent_match){
var current_agent=agent_match[i];
if(typeof wplc_agent_data[current_agent]!=="undefined"){
wplc_agent_data[current_agent].md5;
wplc_agent_data[current_agent].name;
var other={
email: wplc_agent_data[current_agent].md5,
name: wplc_agent_data[current_agent].name,
agent_tagline: wplc_agent_data[current_agent].tagline,
aid: current_agent
};
jQuery.event.trigger({type: "wplc_agent_joined", ndata: {other: other}});
}}
}}
}});
jQuery(document).on("wplc_animation_done", function(e){
jQuery("#nifty_text_editor_holder").remove();
jQuery("#wplc_msg_notice").remove();
jQuery("#wp-live-chat-minimize").remove();
jQuery("#wplc_logo").prependTo("#wplc_chatbox_header");
if(jQuery("wplc_chatbox").hasClass("wplc-shrink")){
jQuery("#wplc_chatbox").css("top",
jQuery("#wplc_chatbox_header").height()+18+"px"
);
}else{
jQuery("#wplc_chatbox").css("top",
jQuery("#wplc_chatbox_header").height()+18+"px"
);
}
jQuery("#wplc_chatbox").css("bottom", "0");
});
jQuery(document).on("wplc_open_chat_2", function(e){
wplc_chat_status=Cookies.get('wplc_chat_status');
if(Cookies.get('wplc_minimize')==='yes'&&!jQuery("#wp-live-chat-header").hasClass("active")){ }else{
jQuery("#wp-live-chat-1").hide();
jQuery("#wp-live-chat-2-inner").hide();
jQuery("#wp-live-chat-2").show();
if(!jQuery("#wp-live-chat-header").hasClass("active")){
jQuery("#wplc_chatmsg").focus();
}
jQuery("#wp-live-chat-header").addClass("active");
jQuery("#wp-live-chat").addClass("mobile-active");
wplc_chat_status=Cookies.get('wplc_chat_status');
if(typeof e.wplc_online!=="undefined"&&e.wplc_online===true){
jQuery("#wp-live-chat-4").show();
jQuery("#nifty_ratings_holder").show();
jQuery.event.trigger({type: "wplc_animation_done"});
}
setTimeout(function(){
wplc_scroll_to_bottom();
},1000);
jQuery("#wp-live-chat-3").hide();
jQuery("#wplc_chatmsg").focus();
jQuery("#wp-live-chat-minimize").css("right","23px");
Cookies.set('wplc_minimize', "", { expires: 1, path: '/' });
}});
var wplc_leave_window_alone=false;
var wplc_currently_animating_agent_header=false;
jQuery(function(){
jQuery("body").on("click", ".tcx_pullup", function(){
jQuery("#wp-live-chat-header").click();
});
jQuery("body").on("click", ".wplc_retry_chat", function(){
var data={
security: wplc_nonce,
chat_id: wplc_cid,
agent_id: 0
};
wplc_rest_api('end_chat', data, 12000, null);
jQuery.event.trigger({type: "wplc_end_chat_as_user"});
});
jQuery("body").on("click", "#wp-live-chat-header", function(){
if(jQuery(this).hasClass('active')){
jQuery("#wplc_hovercard").fadeOut("fast");
jQuery("#wp-live-chat-2").fadeOut("fast");
jQuery(this).removeClass('active');
jQuery.event.trigger({type: "wplc_minimize_chat"});
Cookies.set('wplc_minimize', "yes", { expires: 1, path: '/' });
}else{
if(typeof nc_status==='undefined'||nc_status!=='active'){
jQuery("#wplc_hovercard").fadeIn('fast');
}
jQuery(this).addClass('active');
wplc_chat_status=Cookies.get('wplc_chat_status');
nc_status=Cookies.get('nc_status');
if(parseInt(wplc_chat_status)==3||parseInt(wplc_chat_status)==2||parseInt(wplc_chat_status)==0||parseInt(wplc_chat_status)==12||parseInt(wplc_chat_status)==10||nc_status==='active'){
jQuery("#tcx_bell").hide();
jQuery("#speeching_button").click();
}}
jQuery('#wplc_gdpr_end_chat_notice_container').hide();
});
jQuery("body").on("click", "#wplc_hovercard_min", function(){
jQuery("#wplc_hovercard").fadeOut('fast');
});
jQuery("body").on("click", "#speeching_button", function(){
jQuery("#wplc_hovercard").fadeOut("fast");
jQuery("#wplc-chat-alert").removeClass('is-active');
wplc_is_chat_open=true;
jQuery.event.trigger({type: "wplc_open_chat"});
});
jQuery("body").on("click", "#wp-live-chat-minimize", function(){
jQuery("#wp-live-chat-header").removeClass('active');
});
});
function wplc_animate_agent_header_up(){
if(!wplc_currently_animating_agent_header&&jQuery("#wplc_chatbox_header").hasClass("wplc-shrink")&&jQuery('#wplc_chatbox_header .wplc_agent_info:first-child').html()!==""){
wplc_currently_animating_agent_header=true;
jQuery(".tcx_pullup").removeClass('up');
jQuery(".tcx_pullup").addClass('down');
jQuery(".tcx_pullup").html("");
jQuery("#wplc_chatbox_header").removeClass("wplc-shrink");
jQuery('#wplc_end_chat_button').removeClass('shrink');
jQuery("#wplc_chatbox_header").animate({ maxHeight: "280px", },
{
duration: 700,
complete: function(){
jQuery("#wplc_logo").show();
wplc_currently_animating_agent_header=false;
jQuery("#wplc_chatbox_header").css("max-height", jQuery("#wplc_chatbox_header").outerHeight());
jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px");
},
progress: function(){
jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px");
}}
);
}}
function wplc_animate_agent_header_down(){
if(!wplc_currently_animating_agent_header&&!jQuery("#wplc_chatbox_header").hasClass("wplc-shrink")&&jQuery('#wplc_chatbox_header .wplc_agent_info:first-child').html()!==""){
wplc_currently_animating_agent_header=true;
jQuery(".tcx_pullup").removeClass('down');
jQuery(".tcx_pullup").addClass('up');
jQuery(".tcx_pullup").html("");
jQuery("#wplc_chatbox_header").addClass("wplc-shrink");
jQuery('#wplc_end_chat_button').addClass('shrink');
jQuery("#wplc_chatbox").css("top", "50px");
jQuery("#wplc_chatbox_header").animate({ height: "50px", maxHeight: "50px"},
{
duration: 200,
start: function(){
jQuery("#wplc_logo").hide();
},
complete: function(){
wplc_currently_animating_agent_header=false;
jQuery("#wplc_chatbox_header").css("max-height", "50px");
jQuery("#wplc_chatbox_header").css("height", "auto");
}}
);
}}
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
!function(a){"function"==typeof define&&define.amd?define(["jquery","./core","./mouse","./widget"],a):a(jQuery)}(function(a){return a.widget("ui.draggable",a.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(a,b){this._super(a,b),"handle"===a&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?void(this.destroyOnClear=!0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),void this._mouseDestroy())},_mouseCapture:function(b){var c=this.options;return this._blurActiveElement(b),!(this.helper||c.disabled||a(b.target).closest(".ui-resizable-handle").length>0)&&(this.handle=this._getHandle(b),!!this.handle&&(this._blockFrames(c.iframeFix===!0?"iframe":c.iframeFix),!0))},_blockFrames:function(b){this.iframeBlocks=this.document.find(b).map(function(){var b=a(this);return a("").css("position","absolute").appendTo(b.parent()).outerWidth(b.outerWidth()).outerHeight(b.outerHeight()).offset(b.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(b){var c=this.document[0];if(this.handleElement.is(b.target))try{c.activeElement&&"body"!==c.activeElement.nodeName.toLowerCase()&&a(c.activeElement).blur()}catch(d){}},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===a(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(b),this.originalPosition=this.position=this._generatePosition(b,!1),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._normalizeRightBottom(),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_refreshOffsets:function(a){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:a.pageX-this.offset.left,top:a.pageY-this.offset.top}},_mouseDrag:function(b,c){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(b,!0),this.positionAbs=this._convertPositionTo("absolute"),!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=this,d=!1;return a.ui.ddmanager&&!this.options.dropBehaviour&&(d=a.ui.ddmanager.drop(this,b)),this.dropped&&(d=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!d||"valid"===this.options.revert&&d||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d)?a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",b)!==!1&&c._clear()}):this._trigger("stop",b)!==!1&&this._clear(),!1},_mouseUp:function(b){return this._unblockFrames(),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),this.handleElement.is(b.target)&&this.element.focus(),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){return!this.options.handle||!!a(b.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper),e=d?a(c.helper.apply(this.element[0],[b])):"clone"===c.helper?this.element.clone().removeAttr("id"):this.element;return e.parents("body").length||e.appendTo("parent"===c.appendTo?this.element[0].parentNode:c.appendTo),d&&e[0]===this.element[0]&&this._setPositionRelative(),e[0]===this.element[0]||/(fixed|absolute)/.test(e.css("position"))||e.css("position","absolute"),e},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_isRootNode:function(a){return/(html|body)/i.test(a.tagName)||a===this.document[0]},_getParentOffset:function(){var b=this.offsetParent.offset(),c=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==c&&a.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(b={top:0,left:0}),{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var a=this.element.position(),b=this._isRootNode(this.scrollParent[0]);return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+(b?0:this.scrollParent.scrollTop()),left:a.left-(parseInt(this.helper.css("left"),10)||0)+(b?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b,c,d,e=this.options,f=this.document[0];return this.relativeContainer=null,e.containment?"window"===e.containment?void(this.containment=[a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,a(window).scrollLeft()+a(window).width()-this.helperProportions.width-this.margins.left,a(window).scrollTop()+(a(window).height()||f.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):"document"===e.containment?void(this.containment=[0,0,a(f).width()-this.helperProportions.width-this.margins.left,(a(f).height()||f.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):e.containment.constructor===Array?void(this.containment=e.containment):("parent"===e.containment&&(e.containment=this.helper[0].parentNode),c=a(e.containment),d=c[0],void(d&&(b=/(scroll|auto)/.test(c.css("overflow")),this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(b?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(b?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=c))):void(this.containment=null)},_convertPositionTo:function(a,b){b||(b=this.position);var c="absolute"===a?1:-1,d=this._isRootNode(this.scrollParent[0]);return{top:b.top+this.offset.relative.top*c+this.offset.parent.top*c-("fixed"===this.cssPosition?-this.offset.scroll.top:d?0:this.offset.scroll.top)*c,left:b.left+this.offset.relative.left*c+this.offset.parent.left*c-("fixed"===this.cssPosition?-this.offset.scroll.left:d?0:this.offset.scroll.left)*c}},_generatePosition:function(a,b){var c,d,e,f,g=this.options,h=this._isRootNode(this.scrollParent[0]),i=a.pageX,j=a.pageY;return h&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),b&&(this.containment&&(this.relativeContainer?(d=this.relativeContainer.offset(),c=[this.containment[0]+d.left,this.containment[1]+d.top,this.containment[2]+d.left,this.containment[3]+d.top]):c=this.containment,a.pageX-this.offset.click.left
c[2]&&(i=c[2]+this.offset.click.left),a.pageY-this.offset.click.top>c[3]&&(j=c[3]+this.offset.click.top)),g.grid&&(e=g.grid[1]?this.originalPageY+Math.round((j-this.originalPageY)/g.grid[1])*g.grid[1]:this.originalPageY,j=c?e-this.offset.click.top>=c[1]||e-this.offset.click.top>c[3]?e:e-this.offset.click.top>=c[1]?e-g.grid[1]:e+g.grid[1]:e,f=g.grid[0]?this.originalPageX+Math.round((i-this.originalPageX)/g.grid[0])*g.grid[0]:this.originalPageX,i=c?f-this.offset.click.left>=c[0]||f-this.offset.click.left>c[2]?f:f-this.offset.click.left>=c[0]?f-g.grid[0]:f+g.grid[0]:f),"y"===g.axis&&(i=this.originalPageX),"x"===g.axis&&(j=this.originalPageY)),{top:j-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:h?0:this.offset.scroll.top),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:h?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d,this],!0),/^(drag|start|stop)/.test(b)&&(this.positionAbs=this._convertPositionTo("absolute"),d.offset=this.positionAbs),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c,d){var e=a.extend({},c,{item:d.element});d.sortables=[],a(d.options.connectToSortable).each(function(){var c=a(this).sortable("instance");c&&!c.options.disabled&&(d.sortables.push(c),c.refreshPositions(),c._trigger("activate",b,e))})},stop:function(b,c,d){var e=a.extend({},c,{item:d.element});d.cancelHelperRemoval=!1,a.each(d.sortables,function(){var a=this;a.isOver?(a.isOver=0,d.cancelHelperRemoval=!0,a.cancelHelperRemoval=!1,a._storedCSS={position:a.placeholder.css("position"),top:a.placeholder.css("top"),left:a.placeholder.css("left")},a._mouseStop(b),a.options.helper=a.options._helper):(a.cancelHelperRemoval=!0,a._trigger("deactivate",b,e))})},drag:function(b,c,d){a.each(d.sortables,function(){var e=!1,f=this;f.positionAbs=d.positionAbs,f.helperProportions=d.helperProportions,f.offset.click=d.offset.click,f._intersectsWith(f.containerCache)&&(e=!0,a.each(d.sortables,function(){return this.positionAbs=d.positionAbs,this.helperProportions=d.helperProportions,this.offset.click=d.offset.click,this!==f&&this._intersectsWith(this.containerCache)&&a.contains(f.element[0],this.element[0])&&(e=!1),e})),e?(f.isOver||(f.isOver=1,d._parent=c.helper.parent(),f.currentItem=c.helper.appendTo(f.element).data("ui-sortable-item",!0),f.options._helper=f.options.helper,f.options.helper=function(){return c.helper[0]},b.target=f.currentItem[0],f._mouseCapture(b,!0),f._mouseStart(b,!0,!0),f.offset.click.top=d.offset.click.top,f.offset.click.left=d.offset.click.left,f.offset.parent.left-=d.offset.parent.left-f.offset.parent.left,f.offset.parent.top-=d.offset.parent.top-f.offset.parent.top,d._trigger("toSortable",b),d.dropped=f.element,a.each(d.sortables,function(){this.refreshPositions()}),d.currentItem=d.element,f.fromOutside=d),f.currentItem&&(f._mouseDrag(b),c.position=f.position)):f.isOver&&(f.isOver=0,f.cancelHelperRemoval=!0,f.options._revert=f.options.revert,f.options.revert=!1,f._trigger("out",b,f._uiHash(f)),f._mouseStop(b,!0),f.options.revert=f.options._revert,f.options.helper=f.options._helper,f.placeholder&&f.placeholder.remove(),c.helper.appendTo(d._parent),d._refreshOffsets(b),c.position=d._generatePosition(b,!0),d._trigger("fromSortable",b),d.dropped=!1,a.each(d.sortables,function(){this.refreshPositions()}))})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c,d){var e=a("body"),f=d.options;e.css("cursor")&&(f._cursor=e.css("cursor")),e.css("cursor",f.cursor)},stop:function(b,c,d){var e=d.options;e._cursor&&a("body").css("cursor",e._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c,d){var e=a(c.helper),f=d.options;e.css("opacity")&&(f._opacity=e.css("opacity")),e.css("opacity",f.opacity)},stop:function(b,c,d){var e=d.options;e._opacity&&a(c.helper).css("opacity",e._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(a,b,c){c.scrollParentNotHidden||(c.scrollParentNotHidden=c.helper.scrollParent(!1)),c.scrollParentNotHidden[0]!==c.document[0]&&"HTML"!==c.scrollParentNotHidden[0].tagName&&(c.overflowOffset=c.scrollParentNotHidden.offset())},drag:function(b,c,d){var e=d.options,f=!1,g=d.scrollParentNotHidden[0],h=d.document[0];g!==h&&"HTML"!==g.tagName?(e.axis&&"x"===e.axis||(d.overflowOffset.top+g.offsetHeight-b.pageY=0;m--)i=d.snapElements[m].left-d.margins.left,j=i+d.snapElements[m].width,k=d.snapElements[m].top-d.margins.top,l=k+d.snapElements[m].height,rj+p||tl+p||!a.contains(d.snapElements[m].item.ownerDocument,d.snapElements[m].item)?(d.snapElements[m].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[m].item})),d.snapElements[m].snapping=!1):("inner"!==o.snapMode&&(e=Math.abs(k-t)<=p,f=Math.abs(l-s)<=p,g=Math.abs(i-r)<=p,h=Math.abs(j-q)<=p,e&&(c.position.top=d._convertPositionTo("relative",{top:k-d.helperProportions.height,left:0}).top),f&&(c.position.top=d._convertPositionTo("relative",{top:l,left:0}).top),g&&(c.position.left=d._convertPositionTo("relative",{top:0,left:i-d.helperProportions.width}).left),h&&(c.position.left=d._convertPositionTo("relative",{top:0,left:j}).left)),n=e||f||g||h,"outer"!==o.snapMode&&(e=Math.abs(k-s)<=p,f=Math.abs(l-t)<=p,g=Math.abs(i-q)<=p,h=Math.abs(j-r)<=p,e&&(c.position.top=d._convertPositionTo("relative",{top:k,left:0}).top),f&&(c.position.top=d._convertPositionTo("relative",{top:l-d.helperProportions.height,left:0}).top),g&&(c.position.left=d._convertPositionTo("relative",{top:0,left:i}).left),h&&(c.position.left=d._convertPositionTo("relative",{top:0,left:j-d.helperProportions.width}).left)),!d.snapElements[m].snapping&&(e||f||g||h||n)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[m].item})),d.snapElements[m].snapping=e||f||g||h||n)}}),a.ui.plugin.add("draggable","stack",{start:function(b,c,d){var e,f=d.options,g=a.makeArray(a(f.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});g.length&&(e=parseInt(a(g[0]).css("zIndex"),10)||0,a(g).each(function(b){a(this).css("zIndex",e+b)}),this.css("zIndex",e+g.length))}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c,d){var e=a(c.helper),f=d.options;e.css("zIndex")&&(f._zIndex=e.css("zIndex")),e.css("zIndex",f.zIndex)},stop:function(b,c,d){var e=d.options;e._zIndex&&a(c.helper).css("zIndex",e._zIndex)}}),a.ui.draggable});
function wplc_emit_custom_data_event(action, event_object){
if(typeof socket!=="undefined"&&socket.connected===true){
var a_wplc_cid=Cookies.get('wplc_cid');
if(typeof a_wplc_cid!=='undefined'){
socket.emit('custom data',{ action: action, chatid: a_wplc_cid, ndata: event_object });
}}
};
var wplc_searchTimeout;
var wplc_is_typing=false;
var wplc_has_sent_auto_first_response=false;
var wplc_user_has_left_rating=false;
jQuery(document).on("wplc_animation_done", function(e){
jQuery("#wplc_message").on("keyup", function(){
var wplc_char_count=jQuery('#wplc_message').val().length;
var wplc_char_limit=700;
jQuery('.wplc_char_counter').text(wplc_char_count + " / " + wplc_char_limit);
});
jQuery('.nifty_rating_icon').click(function(evt){
if(!wplc_user_has_left_rating){
jQuery('.nifty_rating_icon').removeClass('wplc-color-1');
jQuery(this).addClass('wplc-color-1');
}});
jQuery("#nifty_rating_pos").click(function(evt){
if(!wplc_user_has_left_rating){
jQuery("#nifty_rating_thanks").hide();
jQuery("#nifty_rating_button").attr("nifty-rating", "1");
jQuery('#nifty_rating_button').click();
wplc_user_has_left_rating=true;
}
evt.stopImmediatePropagation();
});
jQuery("#nifty_rating_neg").click(function(evt){
if(!wplc_user_has_left_rating){
jQuery("#nifty_rating_thanks").hide();
jQuery("#nifty_rating_button").attr("nifty-rating", "0");
jQuery('#nifty_rating_button').click();
wplc_user_has_left_rating=true;
}
evt.stopImmediatePropagation();
});
jQuery("#nifty_rating_button").click(function(evt){
var nifty_rating=jQuery(this).attr("nifty-rating");
var nifty_comment=jQuery("#nifty_ratings_comment").val()!=="" ? jQuery("#nifty_ratings_comment").val():"No Comment...";
jQuery("#nifty_ratings_form").hide();
jQuery("#nifty_recording").fadeIn();
var formData=new FormData();
formData.append('action', 'wplc_record_chat_rating');
formData.append('cid', Cookies.get('wplc_cid'));
formData.append('rating', nifty_rating);
formData.append('comment', nifty_comment);
formData.append('security', wplc_nonce);
formData.append('update_chat_rating', "1");
formData.append('wplc_extra_data[domain]', wplc_extra_data['domain']);
formData.append('wplc_extra_data[api_key]', wplc_extra_data['api_key']);
jQuery.ajax({
url:wplc_ajaxurl,
type:'POST',
data:formData,
cache: false,
processData: false,
contentType: false,
success:function(data){
wplc_pro_rating_show_thanks_message();
},
error:function (){
wplc_pro_rating_show_thanks_message();
}});
jQuery.event.trigger({type: 'wplc_send_live_rating', rating: {score: nifty_rating, comment: nifty_comment}});
evt.stopImmediatePropagation();
});
jQuery("#nifty_rating_button_cancel").click(function(evt){
jQuery('.nifty_rating_icon').removeClass('wplc-color-1');
jQuery("#nifty_ratings_form").fadeOut();
});
function wplc_pro_rating_show_thanks_message(){
jQuery("#nifty_recording").fadeOut();
jQuery("#nifty_rating_thanks").fadeIn();
setTimeout(function(){
jQuery("#nifty_rating_thanks").fadeOut();
}, 2000);
jQuery("#nifty_ratings_comment").val("");
}});
jQuery(function(){
/* this is not working properly
jQuery(document).on("wplc_start_chat", function(e){
var data={
action: 'wplc_start_chat_hook',
security: wplc_nonce,
cid: Cookies.get('wplc_cid'),
wplc_extra_data:{
name: jQuery("#wplc_name").val().replace(/(<([^>]+)>)/ig,""),
email: jQuery("#wplc_email").val().replace(/(<([^>]+)>)/ig,"")
}};
if(!!wplc_restapi_enabled.value){
data.security=(typeof wplc_restapi_token!=="undefined" ? wplc_restapi_token:false);
jQuery.post(wplc_restapi_endpoint+"/new-chat/", data, function(response){});
}});
*/
jQuery("body").on("change", "#wplc_user_selected_department", function(){
if(wplc_extra_data!=="undefined"){
wplc_extra_data['wplc_user_selected_department']=jQuery(this).val();
}});
});
jQuery(document).on("tcx_send_message", function(e){
if(typeof wplc_pro_auto_resp_chat_msg!=='undefined'&&wplc_pro_auto_resp_chat_msg!==""){
if(wplc_has_sent_auto_first_response==false){
if(jQuery('.wplc-admin-message').length <=0){
var first_response_html="";
first_response_html +="";
first_response_html +="" + wplc_safe_html(wplc_pro_auto_resp_chat_msg) + "";
first_response_html +="
";
setTimeout(function(){
jQuery('#wplc_chatbox').append(first_response_html);
var data={
relay_action: 'wplc_admin_send_msg',
security: wplc_nonce,
chat_id: wplc_cid,
message: wplc_pro_auto_resp_chat_msg,
msg_id: Date.now(),
agent_id:0
};
if(typeof wplc_rest_api!=="undefined"){
wplc_rest_api('send_message', data, 12000, null);
}}, 1000);
}
wplc_has_sent_auto_first_response=true;
}}
});
function wplc_start_chat_pro_data(data){
if(typeof wplc_extra_data!=="undefined"&&typeof wplc_extra_data['wplc_user_selected_department']!=="undefined"){
data['wplc_user_selected_department']=wplc_extra_data['wplc_user_selected_department'];
}
return data;
}
function wplcShareFile(fileToUpload, failedID, successID, uploadingID, originalID){
if(fileToUpload==undefined||fileToUpload==false||fileToUpload==null){
return;
}
var afterFailedUpload=function(){
jQuery(uploadingID).hide();
jQuery(failedID).show();
setTimeout(function(){
jQuery(failedID).hide();
jQuery(originalID).show();
}, 2000);
}
var formData=new FormData();
formData.append('action', 'wplc_upload_file');
formData.append('cid', Cookies.get('wplc_cid'));
formData.append('file', fileToUpload);
formData.append('timestamp', Date.now());
formData.append('security', wplc_nonce);
jQuery(uploadingID).show();
jQuery(originalID).hide();
jQuery(successID).hide();
jQuery(failedID).hide();
if(fileToUpload.name.match(new RegExp('^.*\\.(' + config.allowed_upload_extensions + ')$','i'))){
if(fileToUpload.size < 8000000){
jQuery.ajax({
url:wplc_ajaxurl_site,
type:'POST',
data:formData,
cache: false,
processData: false,
contentType: false,
success:function(data){
if(parseInt(data)!==0){
jQuery(uploadingID).hide();
jQuery(successID).show();
setTimeout(function(){
jQuery(successID).hide();
jQuery(originalID).show();
}, 2000);
if(data.substring(0,7)!=='ERROR: '){
var tag='link';
jQuery("#wplc_chatmsg").val(tag + ":" + data + ":" + tag);
jQuery("#wplc_send_msg").trigger("click");
}else{
alert('Upload error: ' + data.substring(7));
afterFailedUpload();
}}else{
afterFailedUpload();
}},
error:function (){
afterFailedUpload();
}});
}else{
alert("File limit is 4mb");
afterFailedUpload();
}}else{
alert("File type not supported.");
afterFailedUpload();
}}
function wplc_start_chat_pro_custom_fields_filter(wplc_extra_data_tmp, rest_action_data, callback){
var custom_field_array={};
var cnt=0;
jQuery('*[name^="wplc_custom_field"]').each(function(key, val){
var field_name=jQuery(this).attr("fname");
custom_field_array[cnt]={};
custom_field_array[cnt][0]=field_name;
custom_field_array[cnt][1]=jQuery(this).val().trim();
if(custom_field_array[cnt][1]==''){
custom_field_array[cnt][1]=jQuery(this).attr('placeholder');
}
cnt++;
});
var custom_data=custom_field_array;
wplc_extra_data_tmp['custom_fields']=JSON.stringify(custom_data);
if(typeof callback==="function"){
rest_action_data.wplc_extra_data=wplc_extra_data_tmp;
callback(wplc_extra_data_tmp, rest_action_data);
}
return wplc_extra_data_tmp;
};
jQuery(function (){
jQuery(document).on("tcx_typing", function(e){
jQuery(".typing_indicator").html(""+wplc_safe_html(e.ndata.username+ config.wplc_localized_string_is_typing_single)+"");
jQuery(".typing_indicator").addClass("typing_indicator_active");
});
jQuery(document).on("tcx_stop_typing", function(e){
jQuery("#wplc_user_typing").fadeOut("slow").remove();
jQuery(".typing_indicator").removeClass("typing_indicator_active")
});
jQuery(document).on("tcx_agent_initiated_chat", function(e){
var data={
relay_action: 'wplc_get_messages',
security: wplc_nonce,
chat_id: wplc_cid,
limit:50,
offset:0,
received_via: 'u',
wplc_extra_data:wplc_extra_data
};
wplc_rest_api('get_messages', data, 12000, function(message_history){
if(typeof message_history.data!=="undefined"&&typeof message_history.data.messages!=="undefined"&&typeof message_history.data.messages==="object"){
message_history=message_history.data.messages;
for (var key in message_history){
var the_message=message_history[key];
the_message.mid=key;
wplc_push_message_to_chatbox(the_message,'u', function(){
wplc_scroll_to_bottom();
});
}}
});
open_chat(1);
jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
});
jQuery(document).on("wplc_send_live_rating", function(e){
if(typeof e.rating!=="undefined"){
if(typeof socket!=="undefined"&&typeof socket.emit!=="undefined"){
socket.emit('custom data',{action:'wplc_send_live_rating', chatid:wplc_cid, rating_data: e.rating});
}}
});
jQuery(document).on("tcx_edited_message", function(e){
if(typeof e.ndata!=="undefined"){
if(typeof e.ndata.message!=="undefined"&&typeof e.ndata.chatid!=="undefined"&&typeof e.ndata.msgID!=="undefined"){
var current_msg=e.ndata.message;
var current_cid=e.ndata.chatid;
var current_msg_id=e.ndata.msgID;
var data={
chat_id: current_cid,
message: current_msg,
msg_id: current_msg_id
};
wplc_rest_api('edit_message', data, 12000, null);
}}
});
jQuery(document).on("wplc_minimize_chat", function(e){
if(typeof socket!=="undefined"&&typeof socket.emit!=="undefined"){
socket.emit('custom data',{action:'wplc_minimized', chatid:wplc_cid});
}});
jQuery(document).on("wplc_open_chat", function(e){
if(typeof socket!=="undefined"&&typeof socket.emit!=="undefined"){
socket.emit('custom data',{action:'wplc_maximized', chatid:wplc_cid});
}});
jQuery(document).on("mouseleave",".wplc-user-message", function(){
var tmid=jQuery(this).attr('mid');
jQuery(".message_"+tmid+ " .tcx-edit-message").hide();
});
jQuery(document).on("mouseenter",".wplc-user-message", function(){
var tmid=jQuery(this).attr('mid');
jQuery(".message_"+tmid+ " .tcx-edit-message").show();
});
});
jQuery(document).on("wplc_animation_done", function(e){
jQuery(function(){
/*jQuery("#wplc_chatmsg").focus(function(){
jQuery("#nifty_text_editor_holder").show();
jQuery("#wplc_msg_notice").hide();
});
jQuery("#wplc_chatmsg").focusout(function(){
setTimeout(function(){
if(document.activeElement.id!=="wplc_chatmsg"){
jQuery("#nifty_text_editor_holder").hide();
jQuery("#wplc_msg_notice").show();
}},200);
});*/
jQuery("#nifty_tedit_b").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("b");
});
jQuery("#nifty_tedit_i").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("i");
});
jQuery("#nifty_tedit_u").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("u");
});
jQuery("#nifty_tedit_strike").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("strike");
});
jQuery("#nifty_tedit_mark").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("mark");
});
jQuery("#nifty_tedit_sub").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("sub");
});
jQuery("#nifty_tedit_sup").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("sup");
});
jQuery("#nifty_tedit_link").click(function(evt){
evt.stopImmediatePropagation();
niftyTextEdit("link");
});
});
});
var selectedIndexStart;
var selectedIndexEnd;
var checkSelection=true;
function getText(elem){
if(checkSelection){
if(elem!==null&&(elem.selectionStart!==null&&typeof elem.selectionStart!=='undefined')){
if(selectedIndexStart!==elem.selectionStart){
selectedIndexStart=elem.selectionStart;
}}
if(elem!==null&&(typeof elem.selectionEnd!=='undefined'&&elem.selectionEnd!==null)){
if(selectedIndexEnd!==elem.selectionEnd){
selectedIndexEnd=elem.selectionEnd;
}}
}}
setInterval(function(){
getText(document.getElementById("wplc_chatmsg"));
}, 1000);
function niftyTextEdit(insertContent){
checkSelection=false;
jQuery("#wplc_chatmsg").focus();
var current=jQuery("#wplc_chatmsg").val();
var pre=current.substr(0, (selectedIndexStart > 0) ? selectedIndexStart:0);
var selection=current.substr(selectedIndexStart, selectedIndexEnd - selectedIndexStart);
var post=current.substr(((selectedIndexEnd < current.length) ? selectedIndexEnd:current.length), current.length);
current=pre + insertContent + ":" + selection + ":" + insertContent + post;
jQuery("#wplc_chatmsg").val(current);
checkSelection=true;
};
(function($){
'use strict';
if(typeof _wpcf7==='undefined'||_wpcf7===null){
return;
}
_wpcf7=$.extend({
cached: 0,
inputs: []
}, _wpcf7);
$.fn.wpcf7InitForm=function(){
this.ajaxForm({
beforeSubmit: function(arr, $form, options){
$form.wpcf7ClearResponseOutput();
$form.find('[aria-invalid]').attr('aria-invalid', 'false');
$form.find('.ajax-loader').addClass('is-active');
return true;
},
beforeSerialize: function($form, options){
$form.find('[placeholder].placeheld').each(function(i, n){
$(n).val('');
});
return true;
},
data: { '_wpcf7_is_ajax_call': 1 },
dataType: 'json',
success: $.wpcf7AjaxSuccess,
error: function(xhr, status, error, $form){
var e=$('').text(error.message);
$form.after(e);
}});
if(_wpcf7.cached){
this.wpcf7OnloadRefill();
}
this.wpcf7ToggleSubmit();
this.find('.wpcf7-submit').wpcf7AjaxLoader();
this.find('.wpcf7-acceptance').click(function(){
$(this).closest('form').wpcf7ToggleSubmit();
});
this.find('.wpcf7-exclusive-checkbox').wpcf7ExclusiveCheckbox();
this.find('.wpcf7-list-item.has-free-text').wpcf7ToggleCheckboxFreetext();
this.find('[placeholder]').wpcf7Placeholder();
if(_wpcf7.jqueryUi&&! _wpcf7.supportHtml5.date){
this.find('input.wpcf7-date[type="date"]').each(function(){
$(this).datepicker({
dateFormat: 'yy-mm-dd',
minDate: new Date($(this).attr('min')),
maxDate: new Date($(this).attr('max'))
});
});
}
if(_wpcf7.jqueryUi&&! _wpcf7.supportHtml5.number){
this.find('input.wpcf7-number[type="number"]').each(function(){
$(this).spinner({
min: $(this).attr('min'),
max: $(this).attr('max'),
step: $(this).attr('step')
});
});
}
this.find('.wpcf7-character-count').wpcf7CharacterCount();
this.find('.wpcf7-validates-as-url').change(function(){
$(this).wpcf7NormalizeUrl();
});
this.find('.wpcf7-recaptcha').wpcf7Recaptcha();
};
$.wpcf7AjaxSuccess=function(data, status, xhr, $form){
if(! $.isPlainObject(data)||$.isEmptyObject(data)){
return;
}
_wpcf7.inputs=$form.serializeArray();
var $responseOutput=$form.find('div.wpcf7-response-output');
$form.wpcf7ClearResponseOutput();
$form.find('.wpcf7-form-control').removeClass('wpcf7-not-valid');
$form.removeClass('invalid spam sent failed');
if(data.captcha){
$form.wpcf7RefillCaptcha(data.captcha);
}
if(data.quiz){
$form.wpcf7RefillQuiz(data.quiz);
}
if(data.invalids){
$.each(data.invalids, function(i, n){
$form.find(n.into).wpcf7NotValidTip(n.message);
$form.find(n.into).find('.wpcf7-form-control').addClass('wpcf7-not-valid');
$form.find(n.into).find('[aria-invalid]').attr('aria-invalid', 'true');
});
$responseOutput.addClass('wpcf7-validation-errors');
$form.addClass('invalid');
$(data.into).wpcf7TriggerEvent('invalid');
}else if(1==data.spam){
$form.find('[name="g-recaptcha-response"]').each(function(){
if(''==$(this).val()){
var $recaptcha=$(this).closest('.wpcf7-form-control-wrap');
$recaptcha.wpcf7NotValidTip(_wpcf7.recaptcha.messages.empty);
}});
$responseOutput.addClass('wpcf7-spam-blocked');
$form.addClass('spam');
$(data.into).wpcf7TriggerEvent('spam');
}else if(1==data.mailSent){
$responseOutput.addClass('wpcf7-mail-sent-ok');
$form.addClass('sent');
if(data.onSentOk){
$.each(data.onSentOk, function(i, n){ eval(n) });
}
$(data.into).wpcf7TriggerEvent('mailsent');
}else{
$responseOutput.addClass('wpcf7-mail-sent-ng');
$form.addClass('failed');
$(data.into).wpcf7TriggerEvent('mailfailed');
}
if(data.onSubmit){
$.each(data.onSubmit, function(i, n){ eval(n) });
}
$(data.into).wpcf7TriggerEvent('submit');
if(1==data.mailSent){
$form.resetForm();
}
$form.find('[placeholder].placeheld').each(function(i, n){
$(n).val($(n).attr('placeholder'));
});
$responseOutput.append(data.message).slideDown('fast');
$responseOutput.attr('role', 'alert');
$.wpcf7UpdateScreenReaderResponse($form, data);
};
$.fn.wpcf7TriggerEvent=function(name){
return this.each(function(){
var elmId=this.id;
var inputs=_wpcf7.inputs;
var event=new CustomEvent('wpcf7' + name, {
bubbles: true,
detail: {
id: elmId,
inputs: inputs
}});
this.dispatchEvent(event);
$(this).trigger('wpcf7:' + name);
$(this).trigger(name + '.wpcf7');
});
};
$.fn.wpcf7ExclusiveCheckbox=function(){
return this.find('input:checkbox').click(function(){
var name=$(this).attr('name');
$(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false);
});
};
$.fn.wpcf7Placeholder=function(){
if(_wpcf7.supportHtml5.placeholder){
return this;
}
return this.each(function(){
$(this).val($(this).attr('placeholder'));
$(this).addClass('placeheld');
$(this).focus(function(){
if($(this).hasClass('placeheld')){
$(this).val('').removeClass('placeheld');
}});
$(this).blur(function(){
if(''===$(this).val()){
$(this).val($(this).attr('placeholder'));
$(this).addClass('placeheld');
}});
});
};
$.fn.wpcf7AjaxLoader=function(){
return this.each(function(){
$(this).after('');
});
};
$.fn.wpcf7ToggleSubmit=function(){
return this.each(function(){
var form=$(this);
if(this.tagName.toLowerCase()!='form'){
form=$(this).find('form').first();
}
if(form.hasClass('wpcf7-acceptance-as-validation')){
return;
}
var submit=form.find('input:submit');
if(! submit.length){
return;
}
var acceptances=form.find('input:checkbox.wpcf7-acceptance');
if(! acceptances.length){
return;
}
submit.removeAttr('disabled');
acceptances.each(function(i, n){
n=$(n);
if(n.hasClass('wpcf7-invert')&&n.is(':checked')
|| ! n.hasClass('wpcf7-invert')&&! n.is(':checked')){
submit.attr('disabled', 'disabled');
}});
});
};
$.fn.wpcf7ToggleCheckboxFreetext=function(){
return this.each(function(){
var $wrap=$(this).closest('.wpcf7-form-control');
if($(this).find(':checkbox, :radio').is(':checked')){
$(this).find(':input.wpcf7-free-text').prop('disabled', false);
}else{
$(this).find(':input.wpcf7-free-text').prop('disabled', true);
}
$wrap.find(':checkbox, :radio').change(function(){
var $cb=$('.has-free-text', $wrap).find(':checkbox, :radio');
var $freetext=$(':input.wpcf7-free-text', $wrap);
if($cb.is(':checked')){
$freetext.prop('disabled', false).focus();
}else{
$freetext.prop('disabled', true);
}});
});
};
$.fn.wpcf7CharacterCount=function(){
return this.each(function(){
var $count=$(this);
var name=$count.attr('data-target-name');
var down=$count.hasClass('down');
var starting=parseInt($count.attr('data-starting-value'), 10);
var maximum=parseInt($count.attr('data-maximum-value'), 10);
var minimum=parseInt($count.attr('data-minimum-value'), 10);
var updateCount=function($target){
var length=$target.val().length;
var count=down ? starting - length:length;
$count.attr('data-current-value', count);
$count.text(count);
if(maximum&&maximum < length){
$count.addClass('too-long');
}else{
$count.removeClass('too-long');
}
if(minimum&&length < minimum){
$count.addClass('too-short');
}else{
$count.removeClass('too-short');
}};
$count.closest('form').find(':input[name="' + name + '"]').each(function(){
updateCount($(this));
$(this).keyup(function(){
updateCount($(this));
});
});
});
};
$.fn.wpcf7NormalizeUrl=function(){
return this.each(function(){
var val=$.trim($(this).val());
if(val&&! val.match(/^[a-z][a-z0-9.+-]*:/i)){
val=val.replace(/^\/+/, '');
val='http://' + val;
}
$(this).val(val);
});
};
$.fn.wpcf7NotValidTip=function(message){
return this.each(function(){
var $into=$(this);
$into.find('span.wpcf7-not-valid-tip').remove();
$into.append('' + message + '');
if($into.is('.use-floating-validation-tip *')){
$('.wpcf7-not-valid-tip', $into).mouseover(function(){
$(this).wpcf7FadeOut();
});
$(':input', $into).focus(function(){
$('.wpcf7-not-valid-tip', $into).not(':hidden').wpcf7FadeOut();
});
}});
};
$.fn.wpcf7FadeOut=function(){
return this.each(function(){
$(this).animate({
opacity: 0
}, 'fast', function(){
$(this).css({ 'z-index': -100 });
});
});
};
$.fn.wpcf7OnloadRefill=function(){
return this.each(function(){
var url=$(this).attr('action');
if(0 < url.indexOf('#')){
url=url.substr(0, url.indexOf('#'));
}
var id=$(this).find('input[name="_wpcf7"]').val();
var unitTag=$(this).find('input[name="_wpcf7_unit_tag"]').val();
$.getJSON(url,
{ _wpcf7_is_ajax_call: 1, _wpcf7: id, _wpcf7_request_ver: $.now() },
function(data){
if(data&&data.captcha){
$('#' + unitTag).wpcf7RefillCaptcha(data.captcha);
}
if(data&&data.quiz){
$('#' + unitTag).wpcf7RefillQuiz(data.quiz);
}}
);
});
};
$.fn.wpcf7RefillCaptcha=function(captcha){
return this.each(function(){
var form=$(this);
$.each(captcha, function(i, n){
form.find(':input[name="' + i + '"]').clearFields();
form.find('img.wpcf7-captcha-' + i).attr('src', n);
var match=/([0-9]+)\.(png|gif|jpeg)$/.exec(n);
form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[ 1 ]);
});
});
};
$.fn.wpcf7RefillQuiz=function(quiz){
return this.each(function(){
var form=$(this);
$.each(quiz, function(i, n){
form.find(':input[name="' + i + '"]').clearFields();
form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[ 0 ]);
form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[ 1 ]);
});
});
};
$.fn.wpcf7ClearResponseOutput=function(){
return this.each(function(){
$(this).find('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked').removeAttr('role');
$(this).find('span.wpcf7-not-valid-tip').remove();
$(this).find('.ajax-loader').removeClass('is-active');
});
};
$.fn.wpcf7Recaptcha=function(){
return this.each(function(){
var events='wpcf7:spam wpcf7:mailsent wpcf7:mailfailed';
$(this).closest('div.wpcf7').on(events, function(e){
if(recaptchaWidgets&&grecaptcha){
$.each(recaptchaWidgets, function(index, value){
grecaptcha.reset(value);
});
}});
});
};
$.wpcf7UpdateScreenReaderResponse=function($form, data){
$('.wpcf7 .screen-reader-response').html('').attr('role', '');
if(data.message){
var $response=$form.siblings('.screen-reader-response').first();
$response.append(data.message);
if(data.invalids){
var $invalids=$('');
$.each(data.invalids, function(i, n){
if(n.idref){
var $li=$('').append($('').attr('href', '#' + n.idref).append(n.message));
}else{
var $li=$('').append(n.message);
}
$invalids.append($li);
});
$response.append($invalids);
}
$response.attr('role', 'alert').focus();
}};
$.wpcf7SupportHtml5=function(){
var features={};
var input=document.createElement('input');
features.placeholder='placeholder' in input;
var inputTypes=[ 'email', 'url', 'tel', 'number', 'range', 'date' ];
$.each(inputTypes, function(index, value){
input.setAttribute('type', value);
features[ value ]=input.type!=='text';
});
return features;
};
$(function(){
_wpcf7.supportHtml5=$.wpcf7SupportHtml5();
$('div.wpcf7 > form').wpcf7InitForm();
});
})(jQuery);
(function (){
if(typeof window.CustomEvent==="function") return false;
function CustomEvent(event, params){
params=params||{ bubbles: false, cancelable: false, detail: undefined };
var evt=document.createEvent('CustomEvent');
evt.initCustomEvent(event,
params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent.prototype=window.Event.prototype;
window.CustomEvent=CustomEvent;
})();